modified to take in account monster stats

monster stats
This commit is contained in:
marcom
2021-03-07 16:22:08 -08:00
parent 853fe1bfb8
commit 62340e2f18
2 changed files with 30 additions and 11 deletions
+9 -3
View File
@@ -320,13 +320,19 @@ export class DeltaGreenActorSheet extends ActorSheet {
let requestedModifyRoll = (event && event.shiftKey || event.which === 3); //(event && (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey));
// check the 'data-target="something" property to determine how to grab the target for the roll
let inhuman_flag = false; // inhuman_flag to be used for stats above 20
if(rollType === "skill" || rollType === "typeskill"){
targetVal = dataset.target;
label = game.i18n.localize(label).toUpperCase();
}
else if(dataset.target === "statistic.x5"){
let stat = this.actor.data.data.statistics[key];
targetVal = stat.x5;
if (stat.value>=20){
targetVal = stat.value;
inhuman_flag = true; // you use the value instead of the x5 but you set the inhuman_flag to true
}else{
targetVal = stat.x5;
}
label = game.i18n.localize("DG.Attributes." + key).toUpperCase();
}
else if(rollType === "sanity"){
@@ -354,7 +360,7 @@ export class DeltaGreenActorSheet extends ActorSheet {
}
else{
if(requestedModifyRoll){
showModifyPercentileTestDialogue(this.actor, label, targetVal, isLethalityRoll);
showModifyPercentileTestDialogue(this.actor, label, targetVal, isLethalityRoll,inhuman_flag);
}
else{
if(isLethalityRoll)
@@ -362,7 +368,7 @@ export class DeltaGreenActorSheet extends ActorSheet {
sendLethalityTestToChat(this.actor, label, targetVal);
}
else{
sendPercentileTestToChat(this.actor, label, targetVal);
sendPercentileTestToChat(this.actor, label, targetVal,inhuman_flag);
}
}
}
+21 -8
View File
@@ -1,4 +1,4 @@
export function sendPercentileTestToChat(actor, skill, target){
export function sendPercentileTestToChat(actor, skill, target, inhuman_flag=false){ // flag check if the stat is above 20
let roll = new Roll('1D100', actor.data.data).roll();
let total = roll.total;
let isCritical = false;
@@ -8,11 +8,24 @@ export function sendPercentileTestToChat(actor, skill, target){
let resultString = '';
let styleOverride = '';
isCritical = skillCheckResultIsCritical(total);
if(total <= target){
isSuccess = true;
}
isCritical = skillCheckResultIsCritical(total); // up to this point everything works as intended
if (inhuman_flag){ // pag 188 of the Handler guide: inhuman stats
//an entity with a stat at 20 or higher succeeds at any stat test except with a roll of 100, which fails
//and fumbles. It gets a critical success on any success with matching digits, and with any roll equal
//to or less than the stat’s value.
if(total <= 99){
isSuccess = true;
if(total <= target){
isCritical = true;
}
}
}else{ // general case
if(total <= target){
isSuccess = true;
}
}
if(isCritical){
resultString = `${game.i18n.localize("DG.Roll.Critical")} `;
@@ -189,7 +202,7 @@ export function sendPercentileTestToChat(actor, skill, target){
});
}
export async function showModifyPercentileTestDialogue(actor, label, originalTarget, isLethalityTest){
export async function showModifyPercentileTestDialogue(actor, label, originalTarget, isLethalityTest,inhuman_flag=false){
let template = "systems/deltagreen/templates/dialog/modify-percentile-roll.html";
let backingData = {
@@ -223,7 +236,7 @@ export function sendPercentileTestToChat(actor, skill, target){
sendLethalityTestToChat(actor, label, newTarget);
}
else{
sendPercentileTestToChat(actor, label, newTarget);
sendPercentileTestToChat(actor, label, newTarget,inhuman_flag); //take care of inhuman stat, by default the value is false
}
}
catch(ex){