fix Talentprobe for negative TaW
This commit is contained in:
parent
474b2b6df7
commit
66e7e93bae
11
src/main.mjs
11
src/main.mjs
@ -884,10 +884,11 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
|||||||
data.modifikator += eBE;
|
data.modifikator += eBE;
|
||||||
|
|
||||||
const talentwert = item.system.talentwert - data.modifikator;
|
const talentwert = item.system.talentwert - data.modifikator;
|
||||||
|
const roll_modifier = talentwert < 0 ? -talentwert: 0;
|
||||||
|
|
||||||
const roll1 = (await new Roll("1d20").evaluate()).total;
|
const roll1 = (await new Roll("1d20").evaluate()).total + roll_modifier;
|
||||||
const roll2 = (await new Roll("1d20").evaluate()).total;
|
const roll2 = (await new Roll("1d20").evaluate()).total + roll_modifier;
|
||||||
const roll3 = (await new Roll("1d20").evaluate()).total;
|
const roll3 = (await new Roll("1d20").evaluate()).total + roll_modifier;
|
||||||
|
|
||||||
const attribute1 = this.document.system.computed.attributes[item.system.attribute1];
|
const attribute1 = this.document.system.computed.attributes[item.system.attribute1];
|
||||||
const attribute2 = this.document.system.computed.attributes[item.system.attribute2];
|
const attribute2 = this.document.system.computed.attributes[item.system.attribute2];
|
||||||
@ -897,7 +898,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
|||||||
const needed_taw_roll2 = Math.max(roll2 - attribute2, 0);
|
const needed_taw_roll2 = Math.max(roll2 - attribute2, 0);
|
||||||
const needed_taw_roll3 = Math.max(roll3 - attribute3, 0);
|
const needed_taw_roll3 = Math.max(roll3 - attribute3, 0);
|
||||||
|
|
||||||
const leftover_taw = talentwert - needed_taw_roll1 - needed_taw_roll2 - needed_taw_roll3;
|
const leftover_taw = Math.max(talentwert, 0) - needed_taw_roll1 - needed_taw_roll2 - needed_taw_roll3;
|
||||||
|
|
||||||
const context = {
|
const context = {
|
||||||
talent: item,
|
talent: item,
|
||||||
@ -915,7 +916,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
|||||||
needed_taw_roll2: -needed_taw_roll2,
|
needed_taw_roll2: -needed_taw_roll2,
|
||||||
needed_taw_roll3: -needed_taw_roll3,
|
needed_taw_roll3: -needed_taw_roll3,
|
||||||
|
|
||||||
leftover_taw: leftover_taw,
|
leftover_taw: Math.min(leftover_taw, item.system.talentwert),
|
||||||
};
|
};
|
||||||
|
|
||||||
const message = await ChatMessage.create(
|
const message = await ChatMessage.create(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user