diff --git a/Star Wars Edge Of The Empire -Dice/EotE-Dice.css b/Star Wars Edge Of The Empire -Dice/EotE-Dice.css new file mode 100644 index 0000000000..0a082dccfa --- /dev/null +++ b/Star Wars Edge Of The Empire -Dice/EotE-Dice.css @@ -0,0 +1,515 @@ +.sheet-clear {clear:both} +.sheet-divider {border-top:1px solid #e3e3e3} + +/* GRID + * ----------------------------------------------------------------- */ + +.sheet-row {padding: 1% 0%; clear: both} +.sheet-column {margin:0 1%; float:left;} +.sheet-column .sheet-column {margin:0 0%; float:left;} + +.sheet-row .sheet-column:last-child {float:right} + +.sheet-small-1 {width: 6.3%} +.sheet-small-2 {width: 14.6%} +.sheet-small-3 {width: 23%}/* 25% */ +.sheet-small-4 {width: 31.3%} +.sheet-small-5 {width: 39.6%} +.sheet-small-6 {width: 48%}/* 50% */ +.sheet-small-7 {width: 56.3%} +.sheet-small-8 {width: 64.6%} +.sheet-small-9 {width: 73%}/* 75% */ +.sheet-small-10 {width: 81.3%} +.sheet-small-11 {width: 91.6%} +.sheet-small-12 {width: 98%}/* 100% */ + +/* Tabs + * ------------------------------------ */ + +.sheet-tabs { + position: relative; + width:100%; + min-height: 100%; /* This part sucks */ + clear: both; + margin: 0; +} + +.sheet-tabs .sheet-sections { + position:absolute; + margin-top:-10px; + background:#485a6d; + width:calc(100% - 10px); + text-align:left; + font-size:14px; + line-height:45px; + font-weight:normal; + padding-top:5px; + padding-left:10px; + +} + +.sheet-tab { + float: left; +} + +.sheet-tab label.sheet-tab-button { + position: absolute; + text-align:left; + font-weight:bold; + font-size:14px; + top:-1px; +} + +.sheet-tab [type=radio] { + position:absolute; + border:none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + height:20px; + top:10px; + outline:none; + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + background-color: transparent; +} + +.sheet-tab-character label.sheet-tab-button { + left: 125px; +} + +.sheet-tab-character [type=radio] { + width: 180px; + z-index:6; + left: 20px; +} + +.sheet-tab-skills label.sheet-tab-button { + left: 245px; +} + +.sheet-tab-skills [type=radio] { + width: 260px; + z-index:5; + left: 100px; +} + +.sheet-tab-gear label.sheet-tab-button { + left: 400px; +} + +.sheet-tab-gear [type=radio] { + width: 280px; + z-index:4; + left: 245px; +} + +.sheet-tab-ship label.sheet-tab-button { + left: 565px; +} + +.sheet-tab-ship [type=radio] { + width: 100px; + z-index:3; + left: 500px; +} + +.sheet-content { + position: absolute; + width:100%; + top: 40px; + left: 0; + background: white; + right: 0; + bottom: 0; + padding: 0; + border-top: 1px solid #444; + display:none; +} + +.sheet-tab label.sheet-tab-button span { + position:absolute; + display:inline-block; + line-height:40px; + padding:0 8px 0 8px; /*35*/ + margin-left:-35px; + color:#fff; +} + +.sheet-tab [type=radio]:checked ~ label.sheet-tab-button span { + border:1px solid #444; + border-bottom:1px solid #fff; + border-radius:4px 4px 0 0; + background-color:#fff; + z-index:2; + color:#444; +} + +.sheet-tab [type=radio]:checked ~ label.sheet-tab-button ~ .sheet-content { + z-index: 1; + display:block; +} + + +/* ------------------------------------ */ + +.charsheet { + padding:0px !important; + margin:0px !important; +} + +.charsheet input[type=number] { + text-align:right; + cursor:pointer; +} + +.charsheet input[type=text], +.charsheet textarea, +.charsheet select { + width:100%; + height:auto; +} + +.charsheet input, +.charsheet textarea { + background:transparent; +} + +.charsheet input:focus, +.charsheet textarea:focus { + background:#fff; +} + +.charsheet textarea { + width:calc(100% - 15px); + height:auto; +} + +.charsheet label { + font-size:11px; + color:#444; + margin:0px; + padding:0px; +} + +.charsheet table { + width:100%; + background-image: url('http://www.stevedaydesign.com/eote-images/bg-eote.jpg'); + background-position:center center; + background-repeat:repeat; + +} + +.charsheet table tr th { + text-align:left; + background:#444; + /*border-right:1px solid #444;*/ + color:#f3f3f3; + padding:3px 5px; +} + +.charsheet table tr th:last-child { + background-image: url('http://www.stevedaydesign.com/eote-images/bg-th-right-corner.png'); + background-position: right bottom; + background-repeat:no-repeat; +} + +.charsheet table tr td { + text-align:left; + padding:3px 5px; + border-bottom:1px dotted #ccc; +} + +.charsheet table tr:hover td { + background:#f1f1f1; +} + +.charsheet table tr td.sheet-div-right { + border-right:1px solid #ccc +} + +.charsheet h3 { + background-image: url('http://www.stevedaydesign.com/eote-images/bg-header.png'), url('http://www.stevedaydesign.com/eote-images/bg-swsd.png');; + background-position: center top, center 5px; + background-repeat:no-repeat, repeat-x; + line-height:40px; + padding:0; + margin:0; + text-align:center; + color:#fff; +} + +/* ------------------------------------------------- Dice Pool */ + +.sheet-section-1 { + padding-bottom:10px; +} + +.sheet-section-1 .sheet-column { + margin-bottom:0px; + margin:0 0; + width:100% +} + +.sheet-dice-pool {border-bottom:1px solid #444;} + +.sheet-dice-pool img { + width:20px; + margin:4px 0 0 -10px; + padding:0px; + position:absolute; +} + +.sheet-dice-pool .sheet-note { + font-size:10px; + font-weight:normal; + color:#d3d3d3; +} + +.sheet-dice-pool td, +.sheet-dice-pool tr:hover td { + background:#444; +} + +.sheet-dice-pool td.sheet-light, +.sheet-dice-pool td.sheet-dark, +.sheet-dice-pool td.sheet-force { + border-right:1px solid #777; + text-align:center; +} + +.sheet-dice-pool td.sheet-force {border-bottom:none} + +.sheet-dice-pool td.sheet-light {} + +.sheet-dice-pool td.sheet-dark {} + +.sheet-dice-pool td.sheet-light:nth-child(1) { + border-left:1px solid #999; +} + +.sheet-dice-pool td.sheet-upgrade, +.sheet-dice-pool td.sheet-downgrade { + text-align:center !important; + border-bottom:1px solid #777; + border-top:1px solid #777; +} + +.sheet-dice-pool [type=number] { + background:#f3f3f3; + width: 50px !important; + height:40px; + font-size:20px; + font-weight:bold; +} + +.sheet-dice-pool [type=number]:focus { + background:#fff; +} + +.sheet-upgrade label, +.sheet-downgrade label { + display:inline-block; + width:auto; + text-algin:center; + color:#f3f3f3; +} + +/* ------------------------------------------------- Soak, Wounds... */ + +.sheet-swsd { + background: url('http://www.stevedaydesign.com/eote-images/bg-swsd.png') center center no-repeat; +} +.sheet-swsd tr:hover td {background-color:transparent;} +.sheet-swsd tr td {border:none;} + + +.sheet-swsd th { + font-size:10px; + font-weight:normal; +} + +.sheet-swsd td { + text-align:center; + vertical-align:top; +} + +.sheet-swsd td:nth-child(1), +.sheet-swsd td:nth-child(3), +.sheet-swsd td:nth-child(5), +.sheet-swsd td:nth-child(7) { + background-image: url('http://www.stevedaydesign.com/eote-images/bg-swsd-box.png'); + background-position: center top; + background-repeat:no-repeat; + width:153px; + height:87px; +} + +.sheet-swsd label { + +} + +.sheet-swsd label.sheet-label-title { + text-align:center; + color:#fff; + font-size:14px; + line-height:25px; + padding-bottom:6px; +} + +.sheet-swsd label.sheet-label-thershold, +.sheet-swsd label.sheet-label-current, +.sheet-swsd label.sheet-label-range, +.sheet-swsd label.sheet-label-melee { + color:#fff; + font-size:9px; + font-weight:normal; + display:inline-block; + width:auto; + padding:0 5px; +} + +.sheet-swsd label.sheet-label-current { + padding-right:16px; +} + +.charsheet .sheet-swsd [type=number] { + font-size:16px; + font-weight:bold; + text-align:right; + width:50px !important; +} + + + +/* ------------------------------------------------- Characteristics */ + +.sheet-characteristics td:nth-child(1), +.sheet-characteristics td:nth-child(3), +.sheet-characteristics td:nth-child(5), +.sheet-characteristics td:nth-child(7), +.sheet-characteristics td:nth-child(9), +.sheet-characteristics td:nth-child(11) +{ + text-align:center; + background-image: url('http://www.stevedaydesign.com/eote-images/bg-char-box.png'); + background-position: center top; + background-repeat:no-repeat; + width:99px; + height:66px; + vertical-align:top; +} + +.sheet-characteristics { + background-image:none; +} + +.sheet-characteristics tr td {border:none;} +.sheet-characteristics tr:hover td {background-color:transparent;} + +.sheet-characteristics label { + text-align:center; + color:#fff; + font-weight:bold; + line-height:15px; + padding-bottom:4px; + font-size:14px; + display:block; +} + +.sheet-characteristics [type=number] { + font-size:14px; + font-weight:bold; +} + + +/* ------------------------------------------------- Skills */ +.sheet-skills td { + width:50px; +} + +.sheet-skills td:nth-child(1) { + width:100%; +} + +.sheet-skills th:nth-child(2), +.sheet-skills td:nth-child(2), +.sheet-custome-skills th:nth-child(3), +.sheet-custome-skills td:nth-child(3) { + text-align:center; +} + +.sheet-custome-skills td:nth-child(1){ + width:50%; +} + +.sheet-custome-skills td:nth-child(2){ + width:25%; +} + +.sheet-skills th:last-child { + background-position: left top; +} + + + +/* -------------------------------------------------- Talents */ + +.sheet-talents th:last-child { + background-image:none; +} + +/* ------------------------------------------------- Weapons */ + +.sheet-weapons td:nth-child(1), +.sheet-weapons td:nth-child(9) { + width:20%; +} + +.sheet-weapons td:nth-child(2), +.sheet-weapons td:nth-child(4), +.sheet-weapons td:nth-child(6), +.sheet-weapons td:nth-child(8) +{ + text-align:center; + background-image: url('http://www.stevedaydesign.com/eote-images/bg-char-box.png'); + background-position: center top; + background-repeat:no-repeat; + width:99px; + height:66px; + vertical-align:top; +} + +.sheet-weapons { + background: url('http://www.stevedaydesign.com/eote-images/bg-swsd.png') center 45px repeat-x; +} + +.sheet-weapons tr td {border:none;} +.sheet-weapons tr:hover td {background-color:transparent;} + +.sheet-weapons label { + text-align:center; + color:#fff; + font-weight:bold; + line-height:15px; + padding-bottom:4px; + font-size:14px; + display:block; +} + +.sheet-weapons [type=number] { + font-size:14px; + font-weight:bold; +} + +.sheet-weapons [type=roll] { + font-size:28px !important; + line-height:30px !important; + width:auto !important; +} + +.sheet-attachments th:last-child { + background:#444; +} + diff --git a/Star Wars Edge Of The Empire -Dice/EotE-Dice.html b/Star Wars Edge Of The Empire -Dice/EotE-Dice.html new file mode 100644 index 0000000000..2f50d117f4 --- /dev/null +++ b/Star Wars Edge Of The Empire -Dice/EotE-Dice.html @@ -0,0 +1,939 @@ + + +
+
+ + + + + + + + + + + + + +
+ + + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ +
+ +

Dice Pool

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ +
+
+
+ + + +
+ +

Sections:

+ +
+ + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +
+
+
+ + +
+
+ + + +

Character

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Description
+ +
+
+ + + + + + + + + + + + +
Notable Features
+ + + + + + + + + + + + +
Other
+ +
+
+
+ +
+
+ + + + + + + + + + + + + + + +
Motivations
+ +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Obligations
+ +
+
+
+ +
+
+ +
+ + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
General SkillsCareer?Rank 
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Combat SkillsCareer?Rank 
Brawl (Br)
Gunnery (Agi)
Melee (Br)
Ranged - Light (Ag)
Ranged - Heavy (Ag)
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Knowledge SkillsCareer?Rank 
Core Worlds (Int)
Education (Int)
Lore (Int)
Outer Rim (Int)
Underworld (Int)
Xenology (Int)
Other:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Custom SkillsCharCareer?Rank 
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ + +
+
+ +

Talents and Special Abilities

+ + + + + + + + + +
NamePage#Ability Summary
+ +
+ + + + + + + + + +
+ +
+ +
+
+
+


+ + +
+
+ +
+ + + +
+ +
+
+ +

Weapons


+ +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Attachment NameHard PointsBase ModifiersModifications
+
+
+ +
+
+ +

Gear Log


+ +
+
+ + + + + + + + + + + +
Armor
+ +
+
+
+ + + + + + + + + + + +
Personal Gear
+ +
+
+
+ + + + + + + + + + + +
Assets & Resources
+ +
+ +
+
+
+ + + +
+
+ + + + + +
diff --git a/Star Wars Edge Of The Empire -Dice/EotE-Dice.js b/Star Wars Edge Of The Empire -Dice/EotE-Dice.js new file mode 100644 index 0000000000..94e00b9c82 --- /dev/null +++ b/Star Wars Edge Of The Empire -Dice/EotE-Dice.js @@ -0,0 +1,1444 @@ +// Edge of the Empire RPG Dice Mechanics +// +// copyright pug games 2014 +// please feel free to use this script, change it, add to it in any way you feel +// Script created by Roll20 user Konrad J. +// help with Dice specs by Roll20 users Alicia G. and Blake the Lake +// dice graphics hosted by Roll20 user Alicia G. at galacticcampaigns.com +// dice graphics borrowed from the awesome google+ hangouts EotE Dice App +// changed to randomInteger() +// +// !eed log on|multi|single|off // default:on and single + // outputs dice rolled to the chat window if "on", only the result if "off" + // dice rolled will be on single line if "single" and on multiple lines if "multi" +// !eed graphics on|off|s|m|l //default:on and m + // shows dice rolled as graphic, small, medium, or large if "on" or as text if "off" +// !eed #b #g #y #blk #p #r #w +// +// !eed w #b #g #y #blk #p #r #w // whisper not really working very well right now, please ignore this option for now + // will roll the dice and whisper them only to the GM, gm can't whisper dice rolls to other players + // due to the way the API currently works we can only send a whisper dice roll via text output, even if you have graphics rolling turned on +// +// !eed test // this will output every side of every die to the chat window +// +// you only need to specify the dice to roll, in any order +// b is blue, g is green, y is yellow, blk is black, p is purple, r is red, w is white +// currently no error checking so you can break it if you type in unsupported arguments + +var eedCONSTANTS = { + EEDCOMMAND : "!eed", + GRAPHICSIZE : { + SMALL : 20, + MEDIUM : 30, + LARGE : 40 + }, + ABILITY : { + BLANK : "http://galacticcampaigns.com/images/EotE/Ability/abilityBlank.png", + A : "http://galacticcampaigns.com/images/EotE/Ability/abilityA.png", + AA : "http://galacticcampaigns.com/images/EotE/Ability/abilityAA.png", + S : "http://galacticcampaigns.com/images/EotE/Ability/abilityS.png", + SA : "http://galacticcampaigns.com/images/EotE/Ability/abilitySA.png", + SS : "http://galacticcampaigns.com/images/EotE/Ability/abilitySS.png" + }, + BOOST : { + BLANK : "http://galacticcampaigns.com/images/EotE/Boost/boostBlank.png", + A : "http://galacticcampaigns.com/images/EotE/Boost/boostA.png", + AA : "http://galacticcampaigns.com/images/EotE/Boost/boostAA.png", + S : "http://galacticcampaigns.com/images/EotE/Boost/boostS.png", + SA : "http://galacticcampaigns.com/images/EotE/Boost/boostSA.png" + }, + CHALLENGE : { + BLANK : "http://galacticcampaigns.com/images/EotE/Challenge/ChallengeBlank.png", + F : "http://galacticcampaigns.com/images/EotE/Challenge/ChallengeF.png", + FF : "http://galacticcampaigns.com/images/EotE/Challenge/ChallengeFF.png", + FT : "http://galacticcampaigns.com/images/EotE/Challenge/ChallengeFT.png", + T : "http://galacticcampaigns.com/images/EotE/Challenge/ChallengeT.png", + TT : "http://galacticcampaigns.com/images/EotE/Challenge/ChallengeTT.png", + DESPAIR : "http://galacticcampaigns.com/images/EotE/Challenge/ChallengeDespair.png" + }, + DIFFICULTY : { + BLANK : "http://galacticcampaigns.com/images/EotE/Difficulty/DifficultyBlank.png", + F : "http://galacticcampaigns.com/images/EotE/Difficulty/DifficultyF.png", + FF : "http://galacticcampaigns.com/images/EotE/Difficulty/DifficultyFF.png", + FT : "http://galacticcampaigns.com/images/EotE/Difficulty/DifficultyFT.png", + T : "http://galacticcampaigns.com/images/EotE/Difficulty/DifficultyT.png", + TT : "http://galacticcampaigns.com/images/EotE/Difficulty/DifficultyTT.png" + }, + FORCE : { + D : "http://galacticcampaigns.com/images/EotE/Force/ForceD.png", + DD : "http://galacticcampaigns.com/images/EotE/Force/ForceDD.png", + L : "http://galacticcampaigns.com/images/EotE/Force/ForceL.png", + LL : "http://galacticcampaigns.com/images/EotE/Force/ForceLL.png" + }, + PROFICIENCY : { + BLANK : "http://galacticcampaigns.com/images/EotE/Proficiency/ProficiencyBlank.png", + A : "http://galacticcampaigns.com/images/EotE/Proficiency/ProficiencyA.png", + S : "http://galacticcampaigns.com/images/EotE/Proficiency/ProficiencyS.png", + SA : "http://galacticcampaigns.com/images/EotE/Proficiency/ProficiencySA.png", + SS : "http://galacticcampaigns.com/images/EotE/Proficiency/ProficiencySS.png", + AA : "http://galacticcampaigns.com/images/EotE/Proficiency/ProficiencyAA.png", + TRIUMPH : "http://galacticcampaigns.com/images/EotE/Proficiency/ProficiencyTriumph.png" + }, + SETBACK : { + BLANK : "http://galacticcampaigns.com/images/EotE/Setback/SetBackBlank.png", + F : "http://galacticcampaigns.com/images/EotE/Setback/SetBackF.png", + T : "http://galacticcampaigns.com/images/EotE/Setback/SetBackT.png" + }, + SYMBOLS : { + A : "http://galacticcampaigns.com/images/EotE/Symbols/A.png", + S : "http://galacticcampaigns.com/images/EotE/Symbols/S.png", + T : "http://galacticcampaigns.com/images/EotE/Symbols/T.png", + F : "http://galacticcampaigns.com/images/EotE/Symbols/F.png", + TRIUMPH : "http://galacticcampaigns.com/images/EotE/Symbols/Triumph.png", + DESPAIR: "http://galacticcampaigns.com/images/EotE/Symbols/Despair.png", + L : "http://galacticcampaigns.com/images/EotE/Symbols/L.png", + D : "http://galacticcampaigns.com/images/EotE/Symbols/D.png" + } +}; + +var eedGlobal = { + diceLogChat : true, + diceLogChatWhisper : false, + diceGraphicsChat : true, + diceGraphicsChatSize : eedCONSTANTS.GRAPHICSIZE.SMALL, + diceTextResult : "", + diceTextResultLog : "", + diceGraphicResult : "", + diceGraphicResultLog : "", + diceTestEnabled : false, + diceLogRolledOnOneLine : true +}; + +function rollBoost(diceQty, who){ + //Blue "Boost" die (d6) + //1 Blank + //2 Blank + //3 Success + //4 Advantage + //5 Advantage + Advantage + //6 Success + Advantage + var roll = 0; + var diceResult = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var i = 0; + var s1 = ''; + + if (eedGlobal.diceTestEnabled === true) { + diceQty = 6; + } + + for (i=1;i<=diceQty;i++) { + if (eedGlobal.diceTestEnabled === true) { + roll = roll + 1; + } + else { + roll = randomInteger(6); + } + + switch(roll) { + case 1: + diceResult.diceTextLog = diceResult.diceTextLog + "(Blank)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.BOOST.BLANK + s2 + "Boost Blank" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + break; + case 2: + diceResult.diceTextLog = diceResult.diceTextLog + "(Blank)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.BOOST.BLANK + s2 + "Boost Blank" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + break; + case 3: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.BOOST.S + s2 + "Boost Success" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + break; + case 4: + diceResult.diceTextLog = diceResult.diceTextLog + "(Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.BOOST.A + s2 + "Boost Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.advantage = diceResult.advantage + 1; + break; + case 5: + diceResult.diceTextLog = diceResult.diceTextLog + "(Advantage x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.BOOST.AA + s2 + "Boost Advantage x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.advantage = diceResult.advantage + 2; + break; + case 6: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success + Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.BOOST.SA + s2 + "Boost Success + Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + diceResult.advantage = diceResult.advantage + 1; + break; + } + } + return diceResult; +} + +function rollAbility(diceQty, who){ + //Green "Ability" die (d8) + //1 Blank + //2 Success + //3 Success + //4 Advantage + //5 Advantage + //6 Success + Advantage + //7 Advantage + Advantage + //8 Success + Success + var roll = 0; + var diceTextLog = ""; + var diceGraphicsLog = ""; + var diceResult = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var i = 0; + var s1 = ''; + + if (eedGlobal.diceTestEnabled === true) { + diceQty = 8; + } + + for (i=1;i<=diceQty;i++) { + if (eedGlobal.diceTestEnabled === true) { + roll = roll + 1; + } + else { + roll = randomInteger(8); + } + + switch(roll) { + case 1: + diceResult.diceTextLog = diceResult.diceTextLog + "(Blank)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.ABILITY.BLANK + s2 + "Ability Blank" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + break; + case 2: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.ABILITY.S + s2 + "Ability Success" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + break; + case 3: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.ABILITY.S + s2 + "Ability Success" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + break; + case 4: + diceResult.diceTextLog = diceResult.diceTextLog + "(Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.ABILITY.A + s2 + "Ability Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.advantage = diceResult.advantage + 1; + break; + case 5: + diceResult.diceTextLog = diceResult.diceTextLog + "(Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.ABILITY.A + s2 + "Ability Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.advantage = diceResult.advantage + 1; + break; + case 6: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success + Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.ABILITY.SA + s2 + "Ability Success + Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + diceResult.advantage = diceResult.advantage + 1; + break; + case 7: + diceResult.diceTextLog = diceResult.diceTextLog + "(Advantage x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.ABILITY.AA + s2 + "Ability Advantage x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.advantage = diceResult.advantage + 2; + break; + case 8: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.ABILITY.SS + s2 + "Ability Success x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 2; + break; + } + } + return diceResult; +} + +function rollProficiency(diceQty, who){ + //Yellow "Proficiency" die (d12) + //1 Blank + //2 Triumph + //3 Success + //4 Success + //5 Advantage + //6 Success + Advantage + //7 Success + Advantage + //8 Success + Advantage + //9 Success + Success + //10 Success + Success + //11 Advantage + Advantage + //12 Advantage + Advantage + var roll = 0; + var diceTextLog = ""; + var diceGraphicsLog = ""; + var diceResult = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var i = 0; + var s1 = ''; + + if (eedGlobal.diceTestEnabled === true) { + diceQty = 12; + } + + for (i=1;i<=diceQty;i++) { + if (eedGlobal.diceTestEnabled === true) { + roll = roll + 1; + } + else { + roll = randomInteger(12); + } + + switch(roll) { + case 1: + diceResult.diceTextLog = diceResult.diceTextLog + "(Blank)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.BLANK + s2 + "Proficiency Blank" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + break; + case 2: + diceResult.diceTextLog = diceResult.diceTextLog + "(Triumph(+Success))"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.TRIUMPH + s2 + "Proficiency Triumph(+Success)" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.triumph = diceResult.triumph + 1; + diceResult.success = diceResult.success + 1; + break; + case 3: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.S + s2 + "Proficiency Success" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + break; + case 4: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.S + s2 + "Proficiency Success" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + break; + case 5: + diceResult.diceTextLog = diceResult.diceTextLog + "(Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.A + s2 + "Proficiency Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.advantage = diceResult.advantage + 1; + break; + case 6: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success + Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.SA + s2 + "Proficiency Success + Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + diceResult.advantage = diceResult.advantage + 1; + break; + case 7: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success + Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.SA + s2 + "Proficiency Success + Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + diceResult.advantage = diceResult.advantage + 1; + break; + case 8: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success + Advantage)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.SA + s2 + "Proficiency Success + Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 1; + diceResult.advantage = diceResult.advantage + 1; + break; + case 9: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.SS + s2 + "Proficiency Success x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 2; + break; + case 10: + diceResult.diceTextLog = diceResult.diceTextLog + "(Success x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.SS + s2 + "Proficiency Success x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.success = diceResult.success + 2; + break; + case 11: + diceResult.diceTextLog = diceResult.diceTextLog + "(Advantage x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.AA + s2 + "Proficiency Advantage x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.advantage = diceResult.advantage + 2; + break; + case 12: + diceResult.diceTextLog = diceResult.diceTextLog + "(Advantage x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.PROFICIENCY.AA + s2 + "Proficiency Advantage x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.advantage = diceResult.advantage + 2; + break; + } + } + return diceResult; +} + +function rollSetBack(diceQty, who){ + //Black "Setback" die (d6) + //1 Blank + //2 Blank + //3 Failure + //4 Failure + //5 Threat + //6 Threat + var roll = 0; + var diceTextLog = ""; + var diceGraphicsLog = ""; + var diceResult = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var i = 0; + var s1 = ''; + + if (eedGlobal.diceTestEnabled === true) { + diceQty = 6; + } + + for (i=1;i<=diceQty;i++) { + if (eedGlobal.diceTestEnabled === true) { + roll = roll + 1; + } + else { + roll = randomInteger(6); + } + + switch(roll) { + case 1: + diceResult.diceTextLog = diceResult.diceTextLog + "(Blank)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.SETBACK.BLANK + s2 + "Setback Blank" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + break; + case 2: + diceResult.diceTextLog = diceResult.diceTextLog + "(Blank)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.SETBACK.BLANK + s2 + "Setback Blank" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + break; + case 3: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.SETBACK.F + s2 + "Setback Failure" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 1; + break; + case 4: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.SETBACK.F + s2 + "Setback Failure" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 1; + break; + case 5: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.SETBACK.T + s2 + "Setback Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 1; + break; + case 6: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.SETBACK.T + s2 + "Setback Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 1; + break; + } + } + return diceResult; +} + +function rollDifficulty(diceQty, who){ + //Purple "Difficulty" die (d8) + //1 Blank + //2 Failure + //3 Threat + //4 Threat + //5 Threat + //6 Failure + Failure + //7 Failure + Threat + //8 Threat + Threat + var roll = 0; + var diceTextLog = ""; + var diceGraphicsLog = ""; + var diceResult = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var i = 0; + var s1 = ''; + + if (eedGlobal.diceTestEnabled === true) { + diceQty = 8; + } + + for (i=1;i<=diceQty;i++) { + if (eedGlobal.diceTestEnabled === true) { + roll = roll + 1; + } + else { + roll = randomInteger(8); + } + + switch(roll) { + case 1: + diceResult.diceTextLog = diceResult.diceTextLog + "(Blank)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.DIFFICULTY.BLANK + s2 + "Difficulty Blank" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + break; + case 2: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.DIFFICULTY.F + s2 + "Difficulty Failure" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 1; + break; + case 3: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.DIFFICULTY.T + s2 + "Difficulty Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 1; + break; + case 4: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.DIFFICULTY.T + s2 + "Difficulty Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 1; + break; + case 5: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.DIFFICULTY.T + s2 + "Difficulty Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 1; + break; + case 6: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.DIFFICULTY.FF + s2 + "Difficulty Failure x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 2; + break; + case 7: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure + Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.DIFFICULTY.FT + s2 + "Difficulty Failure + Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 1; + diceResult.threat = diceResult.threat + 1; + break; + case 8: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.DIFFICULTY.TT + s2 + "Difficulty Threat x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 2; + break; + } + } + return diceResult; +} + +function rollChallenge(diceQty, who){ + //Red "Challenge" die (d12) + //1 Blank + //2 Despair + //3 Failure + //4 Failure + //5 Threat + //6 Threat + //7 Failure + Failure + //8 Failure + Failure + //9 Threat + Threat + //10 Threat + Threat + //11 Failure + Threat + //12 Failure + Threat + var roll = 0; + var diceTextLog = ""; + var diceGraphicsLog = ""; + var diceResult = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var i = 0; + var s1 = ''; + + if (eedGlobal.diceTestEnabled === true) { + diceQty = 12; + } + + for (i=1;i<=diceQty;i++) { + if (eedGlobal.diceTestEnabled === true) { + roll = roll + 1; + } + else { + roll = randomInteger(12); + } + + switch(roll) { + case 1: + diceResult.diceTextLog = diceResult.diceTextLog + "(Blank)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.BLANK + s2 + "Challenge Blank" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + break; + case 2: + diceResult.diceTextLog = diceResult.diceTextLog + "(Despair)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.DESPAIR + s2 + "Challenge Despair" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.despair = diceResult.despair + 1; + break; + case 3: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.F + s2 + "Challenge Failure" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 1; + break; + case 4: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.F + s2 + "Challenge Failure" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 1; + break; + case 5: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.T + s2 + "Challenge Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 1; + break; + case 6: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.T + s2 + "Challenge Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 1; + break; + case 7: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.FF + s2 + "Challenge Failure x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 2; + break; + case 8: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.FF + s2 + "Challenge Failure x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 2; + break; + case 9: + diceTextLog = diceTextLog + "(Threat x2)"; + diceGraphicsLog = diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.TT + s2 + "Challenge Threat x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 2; + break; + case 10: + diceResult.diceTextLog = diceResult.diceTextLog + "(Threat x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.TT + s2 + "Challenge Threat x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.threat = diceResult.threat + 2; + break; + case 11: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure + Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.FT + s2 + "Challenge Failure + Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 1; + diceResult.threat = diceResult.threat + 1; + break; + case 12: + diceResult.diceTextLog = diceResult.diceTextLog + "(Failure + Threat)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.CHALLENGE.FT + s2 + "Challenge Failure + Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.failure = diceResult.failure + 1; + diceResult.threat = diceResult.threat + 1; + break; + } + } + return diceResult; +} + +function rollForce(diceQty, who){ + //White "Force" die (d12) + //1 Light + //2 Light + //3 Light + Light + //4 Light + Light + //5 Light + Light + //6 Dark + //7 Dark + //8 Dark + //9 Dark + //10 Dark + //11 Dark + //12 Dark + Dark + var roll = 0; + var diceTextLog = ""; + var diceGraphicsLog = ""; + var diceResult = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var i = 0; + var s1 = ''; + + if (eedGlobal.diceTestEnabled === true) { + diceQty = 12; + } + + for (i=1;i<=diceQty;i++) { + if (eedGlobal.diceTestEnabled === true) { + roll = roll + 1; + } + else { + roll = randomInteger(12); + } + + switch(roll) { + case 1: + diceResult.diceTextLog = diceResult.diceTextLog + "(Light)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.L + s2 + "Force Light" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.light = diceResult.light + 1; + break; + case 2: + diceResult.diceTextLog = diceResult.diceTextLog + "(Light)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.L + s2 + "Force Light" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.light = diceResult.light + 1; + break; + case 3: + diceResult.diceTextLog = diceResult.diceTextLog + "(Light x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.LL + s2 + "Force Light x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.light = diceResult.light + 2; + break; + case 4: + diceResult.diceTextLog = diceResult.diceTextLog + "(Light x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.LL + s2 + "Force Light x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.light = diceResult.light + 2; + break; + case 5: + diceResult.diceTextLog = diceResult.diceTextLog + "(Light x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.LL + s2 + "Force Light x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.light = diceResult.light + 2; + break; + case 6: + diceResult.diceTextLog = diceResult.diceTextLog + "(Dark)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.D + s2 + "Force Dark" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.dark = diceResult.dark + 1; + break; + case 7: + diceResult.diceTextLog = diceResult.diceTextLog + "(Dark)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.D + s2 + "Force Dark" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.dark = diceResult.dark + 1; + break; + case 8: + diceResult.diceTextLog = diceResult.diceTextLog + "(Dark)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.D + s2 + "Force Dark" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.dark = diceResult.dark + 1; + break; + case 9: + diceResult.diceTextLog = diceResult.diceTextLog + "(Dark)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.D + s2 + "Force Dark" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.dark = diceResult.dark + 1; + break; + case 10: + diceResult.diceTextLog = diceResult.diceTextLog + "(Dark)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.D + s2 + "Force Dark" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.dark = diceResult.dark + 1; + break; + case 11: + diceResult.diceTextLog = diceResult.diceTextLog + "(Dark)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.D + s2 + "Force Dark" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.dark = diceResult.dark + 1; + break; + case 12: + diceResult.diceTextLog = diceResult.diceTextLog + "(Dark x2)"; + diceResult.diceGraphicsLog = diceResult.diceGraphicsLog + s1 + eedCONSTANTS.FORCE.DD + s2 + "Force Dark x2" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + diceResult.dark = diceResult.dark + 2; + break; + } + } + return diceResult; +} + + +function diceAddition(diceTotals, diceResult){ + diceTotals.success = diceTotals.success + diceResult.success; + diceTotals.failure = diceTotals.failure + diceResult.failure; + diceTotals.advantage = diceTotals.advantage + diceResult.advantage; + diceTotals.threat = diceTotals.threat + diceResult.threat; + diceTotals.triumph = diceTotals.triumph + diceResult.triumph; + diceTotals.despair = diceTotals.despair + diceResult.despair; + diceTotals.light = diceTotals.light + diceResult.light; + diceTotals.dark = diceTotals.dark + diceResult.dark; + return diceTotals; +} + +function diceTotalsSummed(diceTotals) { + var diceTS = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var i = 0; + + i = diceTotals.success - diceTotals.failure; + if (i >= 0) { + diceTS.success = i; + } + else { + diceTS.failure = Math.abs(i); + } + + i = diceTotals.advantage - diceTotals.threat; + if (i >= 0) { + diceTS.advantage = i; + } + else { + diceTS.threat = Math.abs(i); + } + diceTS.triumph = diceTotals.triumph; + diceTS.despair = diceTotals.despair; + diceTS.light = diceTotals.light; + diceTS.dark = diceTotals.dark; + return diceTS; +} + +function processEdgeEmpireDiceScript(diceToRoll, who){ + var diceQty = ""; + var diceColor = ""; + var diceTotals = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0 + }; + var diceResults = { + success : 0, + failure : 0, + advantage : 0, + threat : 0, + triumph : 0, + despair : 0, + light : 0, + dark : 0, + diceGraphicsLog : "", + diceTextLog : "" + }; + var diceRolledGraphicsLog = { + Boost: "", + Ability : "", + Proficiency : "", + SetBack : "", + Difficulty : "", + Challenge : "", + Force : "" + }; + var diceRolledTextLog = { + Boost: "", + Ability : "", + Proficiency : "", + SetBack : "", + Difficulty : "", + Challenge : "", + Force : "" + }; + var i = 0; + var j = diceToRoll.length; + var diceTextResults = ""; + var diceGraphicsResults = ""; + var diceTextRolled = ""; + var diceGraphicsRolled = ""; + var s1 = ''; + + // won't work with >9 dice of one colour yet! + for (i=0, j;i 0) { + diceTextResults = diceTextResults + " Success:" + diceTotals.success; + for (i=1;i<=diceTotals.success;i++){ + diceGraphicsResults = diceGraphicsResults + s1 + eedCONSTANTS.SYMBOLS.S + s2 + "Success" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + } + } + if (diceTotals.failure > 0) { + diceTextResults = diceTextResults + " Fail:" + diceTotals.failure; + for (i=1;i<=diceTotals.failure;i++){ + diceGraphicsResults = diceGraphicsResults + s1 + eedCONSTANTS.SYMBOLS.F + s2 + "Failure" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + } + } + if (diceTotals.advantage > 0) { + diceTextResults = diceTextResults + " Advant:" + diceTotals.advantage; + for (i=1;i<=diceTotals.advantage;i++){ + diceGraphicsResults = diceGraphicsResults + s1 + eedCONSTANTS.SYMBOLS.A + s2 + "Advantage" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + } + } + if (diceTotals.threat > 0) { + diceTextResults = diceTextResults + " Threat:" + diceTotals.threat; + for (i=1;i<=diceTotals.threat;i++){ + diceGraphicsResults = diceGraphicsResults + s1 + eedCONSTANTS.SYMBOLS.T + s2 + "Threat" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + } + } + if (diceTotals.triumph > 0) { + diceTextResults = diceTextResults + " Triumph:" + diceTotals.triumph; + for (i=1;i<=diceTotals.triumph;i++){ + diceGraphicsResults = diceGraphicsResults + s1 + eedCONSTANTS.SYMBOLS.TRIUMPH + s2 + "Triumph" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + } + } + if (diceTotals.despair > 0) { + diceTextResults = diceTextResults + " Despair:" + diceTotals.despair; + for (i=1;i<=diceTotals.despair;i++){ + diceGraphicsResults = diceGraphicsResults + s1 + eedCONSTANTS.SYMBOLS.DESPAIR + s2 + "Despair" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + } + } + if (diceTotals.light > 0) { + diceTextResults = diceTextResults + " Light:" + diceTotals.light; + for (i=1;i<=diceTotals.light;i++){ + diceGraphicsResults = diceGraphicsResults + s1 + eedCONSTANTS.SYMBOLS.L + s2 + "Light" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + } + } + if (diceTotals.dark > 0) { + diceTextResults = diceTextResults + " Dark:" + diceTotals.dark; + for (i=1;i<=diceTotals.dark;i++){ + diceGraphicsResults = diceGraphicsResults + s1 + eedCONSTANTS.SYMBOLS.D + s2 + "Dark" + s3 + eedGlobal.diceGraphicsChatSize + s4 + eedGlobal.diceGraphicsChatSize + s5; + } + } + + diceTextResults = diceTextResults + "]"; + + if (eedGlobal.diceTestEnabled === true) { + sendChat("", "/desc " + who + ": 6b 8g 12y 6blk 8p 12r 12w"); + } + else { + if (eedGlobal.diceLogChatWhisper === true) { + //sendChat(who, "/w gm " + diceToRoll); + //sendChat(who, "/w " + who + " " + diceToRoll); + } + else { + sendChat(who, "/em " + diceToRoll); + } + } + + if (eedGlobal.diceLogChat === true) { + if (eedGlobal.diceLogRolledOnOneLine === true) { + diceGraphicsRolled = diceRolledGraphicsLog.Boost + diceRolledGraphicsLog.Ability + diceRolledGraphicsLog.Proficiency + diceRolledGraphicsLog.SetBack + diceRolledGraphicsLog.Difficulty + diceRolledGraphicsLog.Challenge + diceRolledGraphicsLog.Force; + if (diceRolledTextLog.Boost !="") diceTextRolled = diceTextRolled + "Boost:"+diceRolledTextLog.Boost; + if (diceRolledTextLog.Ability !="") diceTextRolled = diceTextRolled + "Ability:"+diceRolledTextLog.Ability; + if (diceRolledTextLog.Proficiency !="") diceTextRolled = diceTextRolled + "Proficiency:"+diceRolledTextLog.Proficiency; + if (diceRolledTextLog.SetBack !="") diceTextRolled = diceTextRolled + "SetBack:"+diceRolledTextLog.SetBack; + if (diceRolledTextLog.Difficulty !="") diceTextRolled = diceTextRolled + "Difficulty:"+diceRolledTextLog.Difficulty; + if (diceRolledTextLog.Challenge !="") diceTextRolled = diceTextRolled + "Challenge:"+diceRolledTextLog.Challenge; + if (diceRolledTextLog.Force !="") diceTextRolled = diceTextRolled + "Force:"+diceRolledTextLog.Force; + + if (eedGlobal.diceGraphicsChat === true && eedGlobal.diceLogChatWhisper === false) { + sendChat("", "/direct " + diceGraphicsRolled); + } + else { + if (eedGlobal.diceLogChatWhisper === true) { + //sendChat("", "/w gm " + diceTextRolled); + //sendChat("", "/w " + who + " " + diceTextRolled); + } + else { + sendChat("", diceTextRolled); + } + } + } + else { + if (eedGlobal.diceGraphicsChat === true && eedGlobal.diceLogChatWhisper === false) { + if (diceRolledGraphicsLog.Boost !="") sendChat("", "/direct " + diceRolledGraphicsLog.Boost); + if (diceRolledGraphicsLog.Ability !="") sendChat("", "/direct " + diceRolledGraphicsLog.Ability); + if (diceRolledGraphicsLog.Proficiency !="") sendChat("", "/direct " + diceRolledGraphicsLog.Proficiency); + if (diceRolledGraphicsLog.SetBack !="") sendChat("", "/direct " + diceRolledGraphicsLog.SetBack); + if (diceRolledGraphicsLog.Difficulty !="") sendChat("", "/direct " + diceRolledGraphicsLog.Difficulty); + if (diceRolledGraphicsLog.Challenge !="") sendChat("", "/direct " + diceRolledGraphicsLog.Challenge); + if (diceRolledGraphicsLog.Force !="") sendChat("", "/direct " + diceRolledGraphicsLog.Force); + } + else { + if (eedGlobal.diceLogChatWhisper === true) { + if (diceRolledTextLog.Boost !="") { + //sendChat("", "/w gm " + diceRolledTextLog.Boost); + //sendChat("", "/w " + who + " " + diceRolledTextLog.Boost); + } + } + else { + if (diceRolledTextLog.Boost !="") sendChat("", "Boost:"+diceRolledTextLog.Boost); + if (diceRolledTextLog.Ability !="") sendChat("", "Ability:"+diceRolledTextLog.Ability); + if (diceRolledTextLog.Proficiency !="") sendChat("", "Proficiency:"+diceRolledTextLog.Proficiency); + if (diceRolledTextLog.SetBack !="") sendChat("", "SetBack:"+diceRolledTextLog.SetBack); + if (diceRolledTextLog.Difficulty !="") sendChat("", "Difficulty:"+diceRolledTextLog.Difficulty); + if (diceRolledTextLog.Challenge !="") sendChat("", "Challenge:"+diceRolledTextLog.Challenge); + if (diceRolledTextLog.Force !="") sendChat("", "Force:"+diceRolledTextLog.Force); + } + } + } + } + + if (eedGlobal.diceGraphicsChat === true && eedGlobal.diceLogChatWhisper === false) { + sendChat("", "/direct Roll:" + diceGraphicsResults); + } + else { + if (eedGlobal.diceLogChatWhisper === true) { + //sendChat("Roll", "/w gm " + diceTextResults); + //sendChat("Roll", "/w " + who + " " + diceTextResults); + } + else { + sendChat("Roll", diceTextResults); + } + } +} + +var processScriptTabs = function(argv, who) { + // this will run the various other scripts depending upon the chat + // window command. Just add another Case statement to add a new command. + var tmpLogChat = false; + var tmpGraphicsChat = false; + + var script = argv.shift(); + switch(script) { + case eedCONSTANTS.EEDCOMMAND: + switch(argv[0]) { + case "log": + switch(argv[1]) { + case "on": + eedGlobal.diceLogChat = true; + break; + case "off": + eedGlobal.diceLogChat = false; + break; + case "multi": + eedGlobal.diceLogRolledOnOneLine = false; + break; + case "single": + eedGlobal.diceLogRolledOnOneLine = true; + break; + + } + break; + case "w": + eedGlobal.diceLogChatWhisper = true; + argv.shift(); + processEdgeEmpireDiceScript(argv, who); + eedGlobal.diceLogChatWhisper = false; + break; + case "graphics": + switch(argv[1]) { + case "on": + eedGlobal.diceGraphicsChat = true; + break; + case "off": + eedGlobal.diceGraphicsChat = false; + break; + case "s": + eedGlobal.diceGraphicsChatSize = eedCONSTANTS.GRAPHICSIZE.SMALL; + break; + case "m": + eedGlobal.diceGraphicsChatSize = eedCONSTANTS.GRAPHICSIZE.MEDIUM; + break; + case "l": + eedGlobal.diceGraphicsChatSize = eedCONSTANTS.GRAPHICSIZE.LARGE; + break; + } + break; + case "test": + eedGlobal.diceTestEnabled = true; + tmpLogChat = eedGlobal.diceLogChat; + tmpGraphicsChat = eedGlobal.diceGraphicsChat; + eedGlobal.diceLogChat = true; + eedGlobal.diceGraphicsChat = true; + processEdgeEmpireDiceScript(["1b", "1g", "1y", "1blk", "1p", "1r", "1w"], who); + eedGlobal.diceTestEnabled = false; + eedGlobal.diceLogChat = tmpLogChat; + eedGlobal.diceGraphicsChat = tmpGraphicsChat; + break; + default: + processEdgeEmpireDiceScript(argv, who); + eedGlobal.diceLogChatWhisper = false; + } + break; + } +}; +//--------------------------------- UPDATE +var createDicePool = function(commandArgv) { + + + //!eed skill(1|6) + //!eed upgrade(ability|4) + //!eed upgrade(difficulty|4) + //!eed downgrade(proficiency|4) + //!eed downgrade(challenge|4) + + + commandArgv = commandArgv.filter(function(e){return e});//clean array of empty null undefined + + Argv = { + Boost: 0, + Ability: 0, + Proficiency: 0, + SetBack: 0, + Difficulty: 0, + Challenge: 0, + Force: 0 + }; + + var regexSkill = /skill\((.*?)\)/; + var regexUpgrade = /upgrade\((.*?)\)/; + var regexDowngrade = /downgrade\((.*?)\)/; + var regexAlphaStr = /[!eed]$|[blk]$|[b]$|[g]$|[y]$|[p]$|[r]$|[w]$/; + + var skillDice = function(dice) { + + var diceArray = dice.split('|'); + var num1 = expr(diceArray[0]); + var num2 = expr(diceArray[1]); + var totalAbil = Math.abs(num1-num2); + var totalProf = (num1 < num2 ? num1 : num2); + + Argv.Ability = Argv.Ability + totalAbil; + Argv.Proficiency = Argv.Proficiency + totalProf; + + /* + var diceArray = dice.split('|'); + var type = diceArray[0]; + var num1 = expr(diceArray[1]); + var num2 = expr(diceArray[2]); + + switch (type) { + case "difficulty" : //purple + + var totalDiff = Math.abs(num1-num2); + var totalChall = (num1 < num2 ? num1 : num2); + Argv.Difficulty = Argv.Difficulty + totalDiff; + Argv.Challenge = Argv.Challenge + totalChall; + + break; + case "ability" : //green + + var totalAbil = Math.abs(num1-num2); + var totalProf = (num1 < num2 ? num1 : num2); + Argv.Ability = Argv.Ability + totalAbil; + Argv.Proficiency = Argv.Proficiency + totalProf; + + break; + } + + return null; + */ + } + + //Create skills + for (var i = 0; i < commandArgv.length; i++) { + + var skillMatch = commandArgv[i].match(regexSkill); + skillMatch = (skillMatch ? skillMatch[1] : false); + + if (skillMatch) { + skillDice(skillMatch); + } + } + + //Evaluates a mathematical expression 4+2g and combine like dice so 2g 3g = 5g + for (var i = 0; i < commandArgv.length; i++) { + + var diceColor = commandArgv[i].match(regexAlphaStr); + var diceQty = 0; + + if (diceColor) { + diceQty = expr(commandArgv[i].replace(diceColor[0],'')); + diceQty = (isNaN(diceQty) ? 0 : diceQty); + + switch(diceColor[0]) { + case 'b' : + Argv.Boost = Argv.Boost + diceQty; + break; + case 'g' : + Argv.Ability = Argv.Ability + diceQty; + break; + case 'y' : + Argv.Proficiency = Argv.Proficiency + diceQty; + break; + case 'blk' : + Argv.SetBack = Argv.SetBack + diceQty; + break; + case 'p' : + Argv.Difficulty = Argv.Difficulty + diceQty; + break; + case 'r' : + Argv.Challenge = Argv.Challenge + diceQty; + break; + case 'w' : + Argv.Force = Argv.Force + diceQty; + break; + default : + break; + + } + } + } + + //upgrade dice + for (var i = 0; i < commandArgv.length; i++) { + var upgradeMatch = commandArgv[i].match(regexUpgrade); + upgradeMatch = (upgradeMatch ? upgradeMatch[1] : false); + + if (upgradeMatch) { + var upgradeArray = upgradeMatch.split('|'); + var type = upgradeArray[0]; + var upgradeVal = Number(upgradeArray[1]); + + switch(type) { + case 'ability': + + var totalProf = (upgradeVal < Argv.Ability ? upgradeVal : Argv.Ability); + var totalAbil = Math.abs(upgradeVal-Argv.Ability); + + if (upgradeVal > Argv.Ability) { + totalProf = totalProf + Math.floor(totalAbil / 2); + totalAbil = totalAbil % 2; + } + + Argv.Ability = totalAbil; + Argv.Proficiency = Argv.Proficiency + totalProf; + + break; + case 'difficulty': + + var totalChall = (upgradeVal < Argv.Difficulty ? upgradeVal : Argv.Difficulty); + var totalDiff = Math.abs(upgradeVal-Argv.Difficulty); + + if (upgradeVal > Argv.Difficulty) { + totalChall = totalChall + Math.floor(totalDiff / 2); + totalDiff = totalDiff % 2; + } + + Argv.Difficulty = totalDiff; + Argv.Challenge = Argv.Challenge + totalChall; + + break; + } + } + } + + + //Downgrade dice + for (var i = 0; i < commandArgv.length; i++) { + var downgradeMatch = commandArgv[i].match(regexDowngrade); + downgradeMatch = (downgradeMatch ? downgradeMatch[1] : false); + + if (downgradeMatch) { + var downgradeArray = downgradeMatch.split('|'); + var type = downgradeArray[0]; + var downgradeVal = Number(downgradeArray[1]); + + switch(type) { + case 'proficiency': + + var profConvertedToAbil = Argv.Proficiency * 2; + + //console.log('downgrade:'+downgradeVal); + //console.log('Before - Prof:'+Argv.Proficiency+' Abil:'+ Argv.Ability); + + if (downgradeVal > (Argv.Ability + profConvertedToAbil)) { + Argv.Ability = 0; + Argv.Proficiency = 0; + } else if (downgradeVal > profConvertedToAbil) { + downgradeVal = Math.abs(downgradeVal - profConvertedToAbil); + Argv.Ability = Math.abs(downgradeVal - Argv.Ability); + Argv.Proficiency = 0; + } else { + Argv.Ability = Argv.Ability + (profConvertedToAbil - downgradeVal) % 2; + Argv.Proficiency = Math.floor((profConvertedToAbil - downgradeVal) / 2); + } + + //console.log('After - Prof:'+Argv.Proficiency+' Abil:'+ Argv.Ability); + + break; + case 'challenge': + + var challConvertedToDiff = Argv.Challenge * 2; + + //console.log('downgrade:'+downgradeVal); + //console.log('Before - Chall:'+Argv.Challenge+' Diff:'+ Argv.Difficulty); + + if (downgradeVal > (Argv.Difficulty + challConvertedToDiff)) { + Argv.Difficulty = 0; + Argv.Challenge = 0; + } else if (downgradeVal > challConvertedToDiff) { + downgradeVal = Math.abs(downgradeVal - challConvertedToDiff); + Argv.Difficulty = Math.abs(downgradeVal - Argv.Difficulty); + Argv.Challenge = 0; + } else { + Argv.Difficulty = Argv.Difficulty + (challConvertedToDiff - downgradeVal) % 2; + Argv.Challenge = Math.floor((challConvertedToDiff - downgradeVal) / 2); + } + + //console.log('After - Chall:'+Argv.Challenge+' Diff:'+ Argv.Difficulty); + + break; + } + } + } + + //Output Argv object in array + + return ['!eed', Argv.Boost+'b', Argv.Ability+'g', Argv.Proficiency+'y', Argv.SetBack+'blk', Argv.Difficulty+'p', Argv.Challenge+'r', Argv.Force+'w']; + +} + +//Evaluates a mathematical expression (as a string) and return the result +var expr = function (expr) { + + var chars = expr.split(""); + var n = [], op = [], index = 0, oplast = true; + + n[index] = ""; + + // Parse the expression + for (var c = 0; c < chars.length; c++) { + + if (isNaN(parseInt(chars[c])) && chars[c] !== "." && !oplast) { + op[index] = chars[c]; + index++; + n[index] = ""; + oplast = true; + } else { + n[index] += chars[c]; + oplast = false; + } + } + + // Calculate the expression + expr = parseFloat(n[0]); + for (var o = 0; o < op.length; o++) { + var num = parseFloat(n[o + 1]); + switch (op[o]) { + case "+": + expr = expr + num; + break; + case "-": + expr = expr - num; + break; + case "*": + expr = expr * num; + break; + case "/": + expr = expr / num; + break; + } + } + + return expr; +} + + +//---------------------------------- END UPDATE + + +on("chat:message", function(msg) { + // returns the chat window command entered, all in lowercase. + + var chatCommand = msg.content; + chatCommand = chatCommand.toLowerCase(); //make all characters lowercase + + var argv = chatCommand.split(' '); + if (msg.type != 'api') { + return; + } + return processScriptTabs(createDicePool(argv), msg.who); +}); diff --git a/Star Wars Edge Of The Empire -Dice/EotE-Dice.png b/Star Wars Edge Of The Empire -Dice/EotE-Dice.png new file mode 100644 index 0000000000..6d233c0392 Binary files /dev/null and b/Star Wars Edge Of The Empire -Dice/EotE-Dice.png differ diff --git a/Star Wars Edge Of The Empire -Dice/sheet.json b/Star Wars Edge Of The Empire -Dice/sheet.json new file mode 100644 index 0000000000..1d1f1c603d --- /dev/null +++ b/Star Wars Edge Of The Empire -Dice/sheet.json @@ -0,0 +1,8 @@ +{ + "html": "EotE-Dice.html", + "css": "EotE-Dice.css", + "authors": "Steve Day", + "preview": "EotE-dice.png", + "roll20userid": "446406", + "instructions": "# Character Sheet\r Define your dice pool: upgrade, downgrade, boost, setback and so on and click on a skill roll button or weapon roll button. You may just define your dice pool and roll without selecting a skill or weapon. Important: Dice rolls will not calculate without EotE-Dice.js added to the Roll20 API. This is Mentor feature only." +} \ No newline at end of file