From 4a70ee031c1d599334f86853de2ac613a68057d2 Mon Sep 17 00:00:00 2001 From: Peter Haldenby Date: Sun, 20 Jun 2021 11:13:20 -0700 Subject: [PATCH] Update JS to same as main sheet, make obsolescence message more prominent --- Demon Gate Scripted/Demon_Gate_Scripted.html | 252 +++++++++++++++---- 1 file changed, 200 insertions(+), 52 deletions(-) diff --git a/Demon Gate Scripted/Demon_Gate_Scripted.html b/Demon Gate Scripted/Demon_Gate_Scripted.html index 8b856ee731..65a6674005 100644 --- a/Demon Gate Scripted/Demon_Gate_Scripted.html +++ b/Demon Gate Scripted/Demon_Gate_Scripted.html @@ -15,7 +15,7 @@ if(rank === "" || rank === "-") { return ""; } - + if(rank > 50) return "4d20!+2d10!"; switch(rank) @@ -285,7 +285,7 @@ function GetSocialPool(chr) { if(chr <= 30) return Math.max(0, Math.floor(chr / 15)); - return Math.min(Math.floor((chr + 10) / 20), 4) + return Math.min(Math.floor((chr + 10) / 20), 4); } function GetRepBonus(chr) @@ -362,7 +362,7 @@ if(saga < 10700) return 63; if(saga < 11100) return 64; if(saga < 11500) return 65; - if(saga < 11900) return ;66 + if(saga < 11900) return 66; if(saga < 12300) return 67; if(saga < 12700) return 68; if(saga < 13100) return 69; @@ -399,6 +399,110 @@ return 100; } + function GetSagaPointsForNextLevel(saga) + { + if(saga < 16) return 16; + if(saga < 37) return 37; + if(saga < 60) return 60; + if(saga < 85) return 85; + if(saga < 115) return 115; + if(saga < 150) return 150; + if(saga < 190) return 190; + if(saga < 235) return 235; + if(saga < 285) return 285; + if(saga < 340) return 340; + if(saga < 400) return 400; + if(saga < 465) return 465; + if(saga < 535) return 535; + if(saga < 610) return 610; + if(saga < 690) return 690; + if(saga < 775) return 775; + if(saga < 865) return 865; + if(saga < 960) return 960; + if(saga < 1060) return 1060; + if(saga < 1165) return 1165; + if(saga < 1275) return 1275; + if(saga < 1390) return 1390; + if(saga < 1510) return 1510; + if(saga < 1635) return 1635; + if(saga < 1765) return 1765; + if(saga < 1900) return 1900; + if(saga < 2040) return 2040; + if(saga < 2185) return 2185; + if(saga < 2335) return 2335; + if(saga < 2490) return 2490; + if(saga < 2650) return 2650; + if(saga < 2815) return 2815; + if(saga < 2985) return 2985; + if(saga < 3160) return 3160; + if(saga < 3340) return 3340; + if(saga < 3525) return 3525; + if(saga < 3715) return 3715; + if(saga < 3910) return 3910; + if(saga < 4105) return 4105; + if(saga < 4300) return 4300; + if(saga < 4495) return 4495; + if(saga < 4690) return 4690; + if(saga < 4890) return 4890; + if(saga < 5095) return 5095; + if(saga < 5300) return 5300; + if(saga < 5500) return 5500; + if(saga < 5700) return 5700; + if(saga < 5900) return 5900; + if(saga < 6100) return 6100; + if(saga < 6400) return 6400; + if(saga < 6700) return 6700; + if(saga < 7000) return 7000; + if(saga < 7300) return 7300; + if(saga < 7600) return 7600; + if(saga < 7900) return 7900; + if(saga < 8200) return 8200; + if(saga < 8500) return 8500; + if(saga < 8800) return 8800; + if(saga < 9100) return 9100; + if(saga < 9500) return 9500; + if(saga < 9900) return 9900; + if(saga < 10300) return 10300; + if(saga < 10700) return 10700; + if(saga < 11100) return 11100; + if(saga < 11500) return 11500; + if(saga < 11900) return 11900; + if(saga < 12300) return 12300; + if(saga < 12700) return 12700; + if(saga < 13100) return 13100; + if(saga < 13600) return 13600; + if(saga < 14100) return 14100; + if(saga < 14600) return 14600; + if(saga < 15100) return 15100; + if(saga < 15600) return 15600; + if(saga < 16100) return 16100; + if(saga < 16600) return 16600; + if(saga < 17100) return 17100; + if(saga < 17600) return 17600; + if(saga < 18100) return 18100; + if(saga < 18700) return 18700; + if(saga < 19200) return 19200; + if(saga < 19800) return 19800; + if(saga < 20400) return 20400; + if(saga < 21000) return 21000; + if(saga < 21600) return 21600; + if(saga < 22200) return 22200; + if(saga < 22800) return 22800; + if(saga < 23400) return 23400; + if(saga < 24000) return 24000; + if(saga < 24700) return 24700; + if(saga < 25400) return 25400; + if(saga < 26100) return 26100; + if(saga < 26800) return 26800; + if(saga < 27500) return 27500; + if(saga < 28200) return 28200; + if(saga < 28900) return 28900; + if(saga < 29600) return 29600; + if(saga < 30300) return 30300; + if(saga < 31000) return 31000; + return '-'; + } + function GetAttributeBonus(attribute, strRank, dexRank, bdyRank, prcRank, intRank, wilRank, chrRank) { switch (attribute) { case "str": @@ -420,7 +524,7 @@ return 0; } } - + function GetConditionModifier(attribute, physMod, menMod) { switch (attribute) { case "str": @@ -437,7 +541,7 @@ return 0; } } - + function UpdateStrength() { getAttrs(["StrBase", "StrBonus", "StrRace"], function(values) @@ -707,7 +811,7 @@ function UpdateStrSkills() { UpdateLifting(); - + UpdateAllAdditionalSkills(); } @@ -716,7 +820,7 @@ UpdateDrinking(); UpdateDrugTolerance(); UpdateEndurance(); - + UpdateAllAdditionalSkills(); } @@ -736,7 +840,7 @@ UpdateStealth(); UpdateSwimming(); UpdateTeamster(); - + UpdateAllAdditionalSkills(); } @@ -769,7 +873,7 @@ UpdateTraps(); UpdateWeatherSense(); UpdateWeaving(); - + UpdateAllAdditionalSkills(); } @@ -815,7 +919,7 @@ UpdateWeaponsmith(); UpdateWildSurvival(); UpdateLangSkills(); - + UpdateAllAdditionalSkills(); } @@ -827,7 +931,7 @@ UpdateExorcism(); UpdateMeditation(); UpdateNecromancy(); - + UpdateAllAdditionalSkills(); } @@ -847,7 +951,7 @@ UpdateSpeech(); UpdateStoryTelling(); UpdateStreetwise(); - + UpdateAllAdditionalSkills(); } @@ -856,6 +960,7 @@ getAttrs(["MaxSaga"], function(values) { setAttrs({Level: GetLevel(values.MaxSaga)}); + setAttrs({NextLevelSaga: GetSagaPointsForNextLevel(values.MaxSaga)}); }); } @@ -1797,7 +1902,7 @@ setAttrs({MeditationDice: GetDice(total)}); }); } - + function UpdateMining() { getAttrs(["IntRank", "MiningRating", "MiningBonus"], function(values) @@ -2343,25 +2448,25 @@ setAttrs({WildDice: GetDice(total)}); }); } - + function UpdateAllAdditionalSkills() { console.log('Updating all additional skills'); - + getSectionIDs("skills", function(ids) { var details = ''; - + for(var i=0; i < ids.length; i++) { var rowId = ids[i]; UpdateAdditionalSkill(rowId); - + var skillsRowName = `repeating_skills_${rowId}_`; if(details !== '') { details += ', \r\n'; } details += skillsRowName; } - + setAttrs({RepeatedSkillFieldIds: details}); }); } @@ -2371,12 +2476,12 @@ if(repeatingRowId !== '') { skillsRowName = skillsRowName + '_'; } - + var skillNameName = `${skillsRowName}SkillName`; var skillAttributeName = `${skillsRowName}SkillAttribute`; var skillRatingName = `${skillsRowName}SkillRating`; var skillBonusName = `${skillsRowName}SkillBonus`; - + getAttrs( ['StrRank', 'DexRank', @@ -2392,12 +2497,12 @@ skillRatingName, skillBonusName], function(values) { - + var skillName = values[skillNameName]; var skillAttribute = values[skillAttributeName]; var skillRating = Number(values[skillRatingName]); var skillBonus = Number(values[skillBonusName]); - + var attributeBonus = GetAttributeBonus( skillAttribute, values.StrRank, @@ -2408,7 +2513,7 @@ values.WilRank, values.ChrRank ); - + var conditionMod = GetConditionModifier(skillAttribute, values.PhysMod, values.MenMod); var total = "-"; @@ -2416,16 +2521,16 @@ { total = attributeBonus + skillRating + skillBonus; } - + var calculatedAttributes = {}; calculatedAttributes[`${skillsRowName}SkillTotal`] = total; calculatedAttributes[`${skillsRowName}SkillDice`] = GetDice(total); calculatedAttributes[`${skillsRowName}SkillConditionMod`] = conditionMod; - + setAttrs(calculatedAttributes); }); } - + function UpdateLangSkills() { getAttrs(["IntRank", "Lang1Rating", "Lang1Bonus", "Lang2Rating", "Lang2Bonus", "Lang3Rating", "Lang3Bonus"], function(values) @@ -2437,7 +2542,7 @@ } setAttrs({Lang1Total: total}); setAttrs({Lang1Dice: GetDice(total)}); - + total = 0; if(Number(values.Lang2Rating) > 0) { @@ -2445,7 +2550,7 @@ } setAttrs({Lang2Total: total}); setAttrs({Lang2Dice: GetDice(total)}); - + total = 0; if(Number(values.Lang3Rating) > 0) { @@ -2684,7 +2789,7 @@ si = 10; break; } - + var bonus = Number(values.SpiritInf) - Number(values.ClassSI); setAttrs({ClassSI: si}); setAttrs({SpiritInf: Number(si) + Number(bonus)}); @@ -3277,62 +3382,62 @@ { UpdateStoryTelling(); }); - + on("change:stsurvrating change:stsurvbonus", function() { UpdateStreetSurvival(); }); - + on("change:streetrating change:streetbonus", function() { UpdateStreetwise(); }); - + on("change:swimrating change:swimbonus", function() { UpdateSwimming(); }); - + on("change:teachrating change:teachbonus", function() { UpdateTeaching(); }); - + on("change:teamrating change:teambonus", function() { UpdateTeamster(); }); - + on("change:thaumrating change:thaumbonus", function() { UpdateThaumaturgy(); }); - + on("change:theorating change:theobonus", function() { UpdateTheology(); }); - + on("change:tinkerrating change:tinkerbonus", function() { UpdateTinker(); }); - + on("change:trackrating change:trackbonus", function() { UpdateTracking(); }); - + on("change:trailrating change:trailbonus", function() { UpdateTrailing(); }); - + on("change:traprating change:trapbonus", function() { UpdateTraps(); }); - + on("change:wpnsmrating change:wpnsmbonus", function() { UpdateWeaponsmith(); @@ -3352,17 +3457,17 @@ { UpdateWildSurvival(); }); - + on("change:physmod change:menmod", function() { UpdateAllAdditionalSkills(); }); - + on("change:repeating_skills:skillattribute change:repeating_skills:skillrating change:repeating_skills:skillbonus", function() { var repeatingRowId = ''; - + UpdateAdditionalSkill(repeatingRowId); }); - + on("change:lang1rating change:lang1bonus change:lang2rating change:lang2bonus change:lang3rating change:lang3bonus", function() { UpdateLangSkills(); @@ -3402,15 +3507,58 @@ { UpdateW6DmgMod(); }); + + on("change:honorrep change:corruptrep", function() + { + getAttrs(["HonorRep", "CorruptRep"], function(values) + { + var goodRepDetails = GetReputationDetails(values.HonorRep); + + var badRepDetails = GetReputationDetails(values.CorruptRep); + + var totalReputation = Number.parseInt(values.HonorRep) + Number.parseInt(values.CorruptRep); + var totalRepDetails = GetReputationDetails(totalReputation); + var talents = totalRepDetails.level - 1; + var totalReputationString = totalReputation.toLocaleString(); + + setAttrs({ + TotalReputation: totalReputationString, + TotalReputationForNextLevel: totalRepDetails.nextLevel, + ReputationTalents: talents, + Glory: totalRepDetails.glory, + HonorTitle: goodRepDetails.goodTitle, + CorruptionTitle: badRepDetails.badTitle + }); + }); + }); + + + function GetReputationDetails(reputation) + { + if(reputation < 100) return { level: 1, nextLevel: '100', glory: 0, goodTitle: 'Unknown', badTitle: 'Unknown' }; + if(reputation < 250) return { level: 2, nextLevel: '250', glory: 10, goodTitle: 'Known', badTitle: 'Wanted' }; + if(reputation < 600) return { level: 3, nextLevel: '600', glory: 20, goodTitle: 'Respected', badTitle: 'Hunted' }; + if(reputation < 1000) return { level: 4, nextLevel: '1,000', glory: 30, goodTitle: 'Highly Respected', badTitle: 'Feared' }; + if(reputation < 1450) return { level: 5, nextLevel: '1,450', glory: 40, goodTitle: 'Local Hero', badTitle: 'Villain' }; + if(reputation < 2000) return { level: 6, nextLevel: '2,000', glory: 50, goodTitle: 'Great Hero', badTitle: 'Infamous Villain' }; + if(reputation < 3000) return { level: 7, nextLevel: '3,000', glory: 55, goodTitle: 'Immortal Hero', badTitle: 'Immortal Villain' }; + if(reputation < 5000) return { level: 8, nextLevel: '5,000', glory: 60, goodTitle: 'Epic Hero', badTitle: 'Arch-villain' }; + if(reputation < 8000) return { level: 9, nextLevel: '8,000', glory: 65, goodTitle: 'Revered Hero', badTitle: 'Nemesis' }; + if(reputation < 12000) return { level: 10, nextLevel: '12,000', glory: 70, goodTitle: 'Legendary Hero', badTitle: 'Arch-nemesis' }; + if(reputation < 50000) return { level: 11, nextLevel: '50,000', glory: 80, goodTitle: 'Great Legendary Hero', badTitle: 'Legendary Arch-nemesis' }; + if(reputation < 100000) return { level: 12, nextLevel: '100,000', glory: 90, goodTitle: 'Exalted Legendary Hero', badTitle: 'Unhallowed Scourge' }; + return { level: 13, nextLevel: '-', glory: 99, goodTitle: 'Demigod', badTitle: 'Demigod' }; + } - - - - -
-

This sheet ("Demon Gate Scripted") has been replaced by a newer copy (called "Demon Gate").

-

Please switch to "Demon Gate" at your earliest convenenience - "Demon Gate Scripted" will eventually be removed

+

+

This sheet ("Demon Gate Scripted") has been replaced by a newer version with more features

+

(called just "Demon Gate").

+

+

This sheet is no longer being supported and "Demon Gate Scripted" will eventually be removed.

+

+

Please switch this game's character sheet to "Demon Gate" at your earliest convenenience. Thanks!

+

Attributes