diff --git a/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.css b/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.css index f6ca7ed84e..2d6f66f678 100644 --- a/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.css +++ b/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.css @@ -3,7 +3,7 @@ /* GRID * ----------------------------------------------------------------- */ - + .sheet-row {padding: 1% 0%; clear: both} .sheet-column {margin:0 1%; float:left;} .sheet-column .sheet-column {margin:0 0%; float:left;} @@ -27,7 +27,6 @@ *-------------------------------------- */ - /* ------------------------------------ */ /* Dice input span graphics @@ -160,6 +159,63 @@ transition: left 0.15s ease-out; } +/* Form Options + * ------------------------------------ */ + +table .sheet-opt-content { + display: none; +} + +input.sheet-opt-vehicle:checked ~ table tr.sheet-opt-vehicle, +input.sheet-opt-ship:checked ~ table tr.sheet-opt-ship +{ + display: table-row; +} + + +input.sheet-opt-vehicle:checked ~ table tr td.sheet-opt-vehicle, +input.sheet-opt-ship:checked ~ table tr td.sheet-opt-ship +{ + display: table-cell; +} + +input.sheet-opt { + + height: 30px; + margin-right:120px; + /*-webkit-appearance:none; + -moz-appearance:none; + appearance:none;*/ + border:none; + outline:none; + position: relative; + cursor: pointer; + z-index: 1; +} + +input.sheet-opt::after { + content: attr(title); + + text-align: left; + display: block; + color:#444; + width: 120px; + padding-left:20px; + line-height: 30px; + font-size: 16px; +} + +input.sheet-opt-vehicle { + margin-left:10px; +} + + +input.sheet-opt:active, +input.sheet-op:focus { + outline:none; +} + + /* Tabs * ------------------------------------ */ @@ -169,6 +225,7 @@ div.sheet-tab-content { margin-top:2px; } + input.sheet-tab-character-sheet:checked ~ div.sheet-tab-character-sheet, input.sheet-tab-ship-sheet:checked ~ div.sheet-tab-ship-sheet, input.sheet-tab-gm-dice:checked ~ div.sheet-tab-gm-dice, @@ -176,10 +233,13 @@ input.sheet-tab-character:checked ~ div.sheet-tab-character, input.sheet-tab-skills:checked ~ div.sheet-tab-skills, input.sheet-tab-talents:checked ~ div.sheet-tab-talents, input.sheet-tab-weapons:checked ~ div.sheet-tab-weapons, -{ +input.sheet-tab-v-details:checked ~ div.sheet-tab-v-details, +input.sheet-tab-v-weapons:checked ~ div.sheet-tab-v-weapons { display: block; } + + input.sheet-tab { width: 162px; height: 30px; @@ -225,8 +285,10 @@ input.sheet-tab:checked:hover::before { background:#fff; } +/* input.sheet-tab-ship-sheet, input.sheet-tab-ship-sheet::before {display:none} +*/ /* ------------------------------------ */ @@ -245,6 +307,7 @@ input.sheet-tab-ship-sheet::before {display:none} .charsheet select { width:100%; height:auto; + margin-bottom:0px; } .charsheet input, @@ -443,18 +506,18 @@ input.sheet-tab-ship-sheet::before {display:none} } -.sheet-swsd label.sheet-label-title { +label.sheet-label-title { text-align:center; color:#fff; - font-size:14px; + font-size:13px; line-height:25px; padding-bottom:6px; } -.sheet-swsd label.sheet-label-threshold, -.sheet-swsd label.sheet-label-current, -.sheet-swsd label.sheet-label-range, -.sheet-swsd label.sheet-label-melee { +label.sheet-label-threshold, +label.sheet-label-current, +label.sheet-label-range, +label.sheet-label-melee { color:#fff; font-size:9px; font-weight:normal; @@ -463,7 +526,7 @@ input.sheet-tab-ship-sheet::before {display:none} padding:0 5px; } -.sheet-swsd label.sheet-label-current { +label.sheet-label-current { padding-right:16px; } @@ -551,7 +614,8 @@ input.sheet-tab-ship-sheet::before {display:none} } -[name="attr_critAddRangeNum"] { +[name="attr_critAddRangeNum"], +[name="attr_critShipAddRangeNum"]{ background:#ccc; } @@ -624,6 +688,9 @@ button.sheet-btn-roll-crit[type=roll]:active { width:50px; } + +.sheet-init td:nth-child(2), +.sheet-init td:nth-child(5), .sheet-skills td:nth-child(4) { width:120px; background-image:url('http://i.imgur.com/fY7gsGx.png'); @@ -900,3 +967,157 @@ input.sheet-view-attachments:checked ~ .sheet-attachments { .sheet-attachments th:last-child { background:#444; } + +/* ---------------------------------------------------------- Ship */ + +.sheet-ship { + background:url('http://i.imgur.com/R7CME69.png') center center no-repeat; + background-color:transparent; + +} + +table.sheet-ship tr td { + border:none; + background-color:transparent; + +} + +table.sheet-ship tr:hover td { + background-color:transparent; +} + +.sheet-ship-defense { + background:url('http://i.imgur.com/VaTaF9r.png') center center no-repeat; + width:302px; + height:236px; + text-align:center; + vertical-align:top; +} + +.sheet-ship-char-thre-bg { + background-image: url('http://i.imgur.com/cODj4n5.png'); + background-position: center 0px; + background-repeat:no-repeat; + vertical-align:top; + width: 33%;/*153px;*/ + height:87px; + text-align:center; +} + +.sheet-ship-char-bg { + text-align:center; + background-image: url('http://i.imgur.com/cyPJPLg.png'); + background-position: center 37px; + background-repeat:no-repeat; + width:99px; + height:66px; + vertical-align:top; + text-align:center; + padding-top:40px; +} + +.sheet-ship-char-bg label { + text-align:center; + color:#fff; + font-weight:bold; + line-height:15px; + padding-bottom:4px; + font-size:13px; + display:block; +} + +.sheet-ship [type=number] { + font-size:16px; + font-weight:bold; + text-align:right; + width:50px !important; +} + +.sheet-ship-char-bg [type=number] { + font-size:14px; +} + +.sheet-ship-defense label { + color:#fff; + text-align:center +} + +.sheet-def-label { + position:absolute; + width:50px; + margin-left:220px; + margin-top:48px; + font-size:14px +} + +.sheet-fore, +.sheet-starboard, +.sheet-aft, +.sheet-port { + width:99px; + height:66px; + position:absolute; +} + +.sheet-fore { + margin-left:99px; + margin-top:2px; +} + +.sheet-starboard { + margin-left:203px; + margin-top:91px; +} + +.sheet-aft { + margin-left:99px; + margin-top:172px; +} + +.sheet-port { + margin-left:0px; + margin-top:91px; +} + +.sheet-firearc-field {width:32px; height:32px; padding:1px 0 0 0; vertical-align:top} + +.sheet-fireArcFore, +.sheet-fireArcStarboard, +.sheet-fireArcAft, +.sheet-fireArcPort { + position:absolute; + z-index:5; + opacity:0.0; +} + +.sheet-fireArcFore {margin-left:10px; margin-top:0px} +.sheet-fireArcStarboard {margin-left:20px; margin-top:10px} +.sheet-fireArcAft {margin-left:10px; margin-top:20px} +.sheet-fireArcPort {margin-left:0px; margin-top:10px} + + +/* http://i.imgur.com/DcWGIWp.png */ +span.sheet-fireArcForeImg, +span.sheet-fireArcStarboardImg, +span.sheet-fireArcAftImg, +span.sheet-fireArcPortImg { + background:url('http://i.imgur.com/DcWGIWp.png') left bottom no-repeat; + display:block; + width:32px; + height:32px; + position:absolute; + + } + +span.sheet-fireArcForeImg {background-position:0px bottom} +span.sheet-fireArcStarboardImg {background-position:-32px bottom} +span.sheet-fireArcAftImg {background-position:-64px bottom} +span.sheet-fireArcPortImg {background-position:-96px bottom} + +.sheet-fireArcFore:checked ~ span.sheet-fireArcForeImg {background-position:0px top} +.sheet-fireArcStarboard:checked ~ span.sheet-fireArcStarboardImg {background-position:-32px top} +.sheet-fireArcAft:checked ~ span.sheet-fireArcAftImg {background-position:-64px top} +.sheet-fireArcPort:checked ~ span.sheet-fireArcPortImg {background-position:-96px top} + + + diff --git a/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.html b/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.html index 4dd6b951ec..4e6365f847 100644 --- a/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.html +++ b/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.html @@ -1,6 +1,6 @@ - +
@@ -908,6 +908,36 @@

Skills

+ + + + + + + + + + + +
+ + + + + + + + + + + + + +
@@ -1053,9 +1083,9 @@
Overview (p71)
@@ -1146,7 +1176,7 @@
Overview (p72)
@@ -1324,7 +1354,7 @@
  • Open a locked door, control an elevator or bypass a security system.
  • Search through records, particularly if encrypted.
  • Investigate what actions a slicer might have taken against a computer system.
  • -
  • Alter a droid’s programming or gain access to its memories.
  • +
  • Alter a droid?s programming or gain access to its memories.
  • Recover data from a system that has suffered physical damage.
  • @@ -1358,7 +1388,7 @@
    Per Triumph
    @@ -1393,7 +1423,7 @@ sliced. Add to the check of any NPC using the target system to slice the - character’s system. + character?s system. @@ -1638,7 +1668,7 @@
    Per Triumph
    @@ -1839,14 +1869,14 @@
    Per Despair
    @@ -2081,7 +2111,7 @@
    Per Additional Success
    @@ -2161,7 +2191,7 @@ @@ -2249,7 +2279,7 @@
    Overview (p78)
    @@ -2274,7 +2304,7 @@
    Per Advantage
    @@ -2363,7 +2393,7 @@
    Per Advantage
    @@ -2429,7 +2459,7 @@ @@ -2606,7 +2636,7 @@
    Overview (p80)
    @@ -2783,7 +2813,7 @@ @@ -3147,7 +3177,7 @@
    Overview (p85)
    @@ -3182,7 +3212,7 @@
    @@ -3779,10 +3809,7 @@ - - - - + @@ -3790,6 +3817,935 @@ +
    + +
    +
    +
    + + + + + + + + + + + +
    + + + + + + + + + +
    + +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    + +
    + + + + + +
    + + +
    + + +
    + + +
    +
    +
    + + + + + + + +
    +
    +
    + +
    + + +

    + +

    Details

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

    Vehicle Critical

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

    Cargo Hold

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

    Weapons

    + + + + + + + + + + + +
    WeaponArcCritDmgRangeSkillSpecial
    + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    +

    Attachments

    + + + + + + + + +
    NameHard pointsBase ModifiersModifications
    + +
    + + + + + + + + + + +
    + +
    + +
    + +
    @@ -3844,4 +4800,4 @@
    - + \ No newline at end of file diff --git a/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.js b/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.js index 4db133300b..26bc78455f 100644 --- a/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.js +++ b/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.js @@ -13,11 +13,11 @@ // 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 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 @@ -26,6 +26,10 @@ // // !eed test // this will output every side of every die to the chat window // + +// !eed npcinit #b #g #y #blk #p #r #w //Will roll for a NPC initiative slot in the form of "SUCCESS:ADVANTAGE". Auto sorts baed on rules in the CRB. +// !eed pcinit #b #g #y #blk #p #r #w //Will roll for a PC initiative slot in the form of "SUCCESS:ADVANTAGE". Auto sorts baed on rules in the CRB. + // 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 @@ -111,9 +115,59 @@ var eedGlobal = { diceGraphicResult : "", diceGraphicResultLog : "", diceTestEnabled : false, - diceLogRolledOnOneLine : true + diceLogRolledOnOneLine : true, + diceNPCInit : false, + dicePCInit : false }; +function sendToTurnOrder(type, NumSuccess, NumAdvantage) { + var turnorder; + if(Campaign().get("turnorder") == "") turnorder = []; //NOTE: We check to make sure that the turnorder isn't just an empty string first. If it is treat it like an empty array. + else turnorder = JSON.parse(Campaign().get("turnorder")); + + //Add a new custom entry to the end of the turn order. + + turnorder.push({ + id: "-1", + pr: NumSuccess + ":" + NumAdvantage, + custom: type + }); + + turnorder.sort(function(x,y) { + var a = x.pr.split(":"); + var b = y.pr.split(":"); + + //First rank on successes + if (b[0] - a[0] != 0) + { + return b[0] - a[0]; + } + //Then rank on Advantage + else if (b[1] - a[1] != 0) + { + return b[1] - a[1]; + } + else + { + //If they are still tied, PC goes first + if (x.custom == y.custom) + { + return 0; + } + else if (x.custom =="NPC") + { + return 1; + } + else + { + return -1; + } + } + }); + + Campaign().set("turnorder", JSON.stringify(turnorder)); +} + function rollBoost(diceQty, who){ //Blue "Boost" die (d6) //1 Blank @@ -1019,7 +1073,7 @@ function processEdgeEmpireDiceScript(diceToRoll, who, label){ } else { - chatGlobal = "/direct
    Skill: " + label + '
    ' + diceToRoll; + chatGlobal = "/direct
    Skill: " + label + '
    ';//+ diceToRoll; } } @@ -1083,6 +1137,15 @@ function processEdgeEmpireDiceScript(diceToRoll, who, label){ if (eedGlobal.diceGraphicsChat === true && eedGlobal.diceLogChatWhisper === false) { chatGlobal = chatGlobal + '
    Roll:' + diceGraphicsResults; sendChat(who, chatGlobal ); + + + if (eedGlobal.diceNPCInit === true) { + sendToTurnOrder("NPC", diceTotals.success, diceTotals.advantage) + } + else if (eedGlobal.dicePCInit === true) { + sendToTurnOrder("PC", diceTotals.success, diceTotals.advantage) + } + } else { if (eedGlobal.diceLogChatWhisper === true) { @@ -1147,6 +1210,14 @@ var processScriptTabs = function(argv, character, label) { break; } break; + case "npcinit": + eedGlobal.diceNPCInit = true; + eedGlobal.dicePCInit = false; + break; + case "pcinit": + eedGlobal.dicePCInit = true; + eedGlobal.diceNPCInit = false; + break; case "test": eedGlobal.diceTestEnabled = true; tmpLogChat = eedGlobal.diceLogChat; @@ -1159,6 +1230,8 @@ var processScriptTabs = function(argv, character, label) { eedGlobal.diceGraphicsChat = tmpGraphicsChat; break; default: + eedGlobal.dicePCInit = false; + eedGlobal.diceNPCInit = false; //argv.splice(1,2); //processEdgeEmpireDiceScript(argv, character, label); //eedGlobal.diceLogChatWhisper = false; @@ -1167,6 +1240,147 @@ var processScriptTabs = function(argv, character, label) { } }; +//--------------------------------- Vehicle Critical + +var critShipTable = [ + { + percent : '1 to 9', + severity : 1, + name : 'Mechanical Stress', + Result : 'Ship or vehicle suffers 1 system strain.', + effect : '', + }, + { + percent : '10 to 18', + severity : 1, + name : 'Jostled', + Result : 'All crew members suffer 1 strain.', + effect : '', + }, + { + percent : '19 to 27', + severity : 1, + name : 'Losing Power to Shields', + Result : 'Decrease defense in affected defense zone by 1 until repaired. If ship or vehicle has no defense, suffer 1 system strain.', + effect : '', + }, + { + percent : '28 to 36', + severity : 1, + name : 'Knocked Off Course', + Result : 'On next turn, pilot cannot execute any maneuvers. Instead, must make a Piloting check to regain bearings and resume course. Difficulty depends on current speed.', + effect : '', + }, + { + percent : '37 to 45', + severity : 1, + name : 'Tailspin', + Result : 'All firing from ship or vehicle suffers 2 setback dice until end of pilot\'s next turn.', + effect : '', + }, + { + percent : '46 to 54', + severity : 1, + name : 'Component Hit', + Result : 'One component of the attacker\'s choice is knocked offline, and is rendered inoperable until the end of the following round. See page 245 CRB for Small/Large Vehicle and Ship Component tables. ', + effect : '', + }, + // --------------- severity : 2 + { + percent : '55 to 63', + severity : 2, + name : 'Shields Failing', + Result : 'Decrease defense in all defense zones by 1 until repaired. If ship or vehicle has no defense, suffer 2 system strain.', + effect : '', + }, + { + percent : '64 to 72', + severity : 2, + name : 'Hyperdrive or Navicomputer Failure', + Result : 'Cannot make any jump to hyperspace until repaired. If ship or vehicle has no hyperdrive, navigation systems fail leaving it unable to tell where it is or is going.', + effect : '', + }, + { + percent : '73 to 81', + severity : 2, + name : 'Power Fluctuations', + Result : 'Pilot cannot voluntarily inflict system strain on the ship until repaired.', + effect : '', + }, + // --------------- severity : 3 + { + percent : '82 to 90', + severity : 3, + name : 'Shields Down', + Result : 'Decrease defense in affected defense zone to 0 and all other defense zones by 1 point until repaired. If ship or vehicle has no defense, suffer 4 system strain.', + effect : '', + }, + { + percent : '91 to 99', + severity : 3, + name : 'Engine Damaged', + Result : 'Ship or vehicle\'s maximum speed reduced by 1, to a minimum of 1, until repaired.', + effect : '', + }, + { + percent : '100 to 108', + severity : 3, + name : 'Shield Overload', + Result : 'Decrease defense in all defense zones to 0 until repaired. In addition, suffer 2 system strain. Cannot be repaired until end of encounter. If ship or vehicle has no defense, reduce armor by 1 until repaired.', + effect : '', + }, + { + percent : '109 to 117', + severity : 3, + name : 'Engines Down', + Result : 'Ship or vehicle\'s maximum speed reduced to 0. In addition, ship or vehicle cannot execute maneuvers until repaired. Ship continues on course at current speed and cannot be stopped or course changed until repaired.', + effect : '', + }, + { + percent : '118 to 126', + severity : 3, + name : 'Major System Failure', + Result : 'One component of the attacker\'s choice is heavily damages, and is inoperable until the critical hit is repaired. See page 245 CRB for Small/Large Vehicle and Ship Component tables. ', + effect : '', + }, + // --------------- severity : 4 + { + percent : '127 to 133', + severity : 4, + name : 'Major Hull Breach', + Result : 'Ships and vehicles of silhouette 4 and smaller depressurize in a number of rounds equal to silhouette. Ships of silhouette 5 and larger don\'t completely depressurize, but parts do (specifics at GM discretion). Ships and vehicles operating in atmosphere instead suffer a Destabilized Critical.', + effect : '', + }, + { + percent : '134 to 138', + severity : 4, + name : 'Destabilised', + Result : 'Reduce ship or vehicle\'s hull integrity threshold and system strain threshold to half original values until repaired.', + effect : '', + }, + { + percent : '139 to 144', + severity : 4, + name : 'Fire!', + Result : 'Fire rages through ship or vehicle and it immediately takes 2 system strain. Fire can be extinguished with appropriate skill, Vigilance or Cool checks at GM\'s discretion. Takes one round per two silhouette to put out.', + effect : '', + }, + { + percent : '145 to 153', + severity : 4, + name : 'Breaking Up', + Result : 'At the end of next round, ship is completely destroyed. Anyone aboard has one round to reach escape pod or bail out before they are lost.', + effect : '', + }, + { + percent : '154+', + severity : 4, + name : 'Vaporized', + Result : 'The ship or Vehicle is completely destroyed.', + effect : '', + } +] + //--------------------------------- Critical Injury var critTable = [ @@ -1388,6 +1602,7 @@ var createDicePool = function(msg, who, playerid) { //!eed downgrade(proficiency|4) //!eed downgrade(challenge|4) + if (!msg.match(/!eed/)) { return false; @@ -1415,6 +1630,7 @@ var createDicePool = function(msg, who, playerid) { var regexEncum = /encum\((.*?)\)/; var regexAlphaStr = /blk$|b$|g$|y$|p$|r$|w$/; var regexCrit = /crit\((.*?)\)/; + var regexCritShip = /critship\((.*?)\)/; var skillDice = function(dice) { @@ -1429,6 +1645,181 @@ var createDicePool = function(msg, who, playerid) { } + //CritShip + var getCritShipID = function() { + + return { + 1 : getAttrByName(characterId, 'critShipOn1'), + 2 : getAttrByName(characterId, 'critShipOn2'), + 3 : getAttrByName(characterId, 'critShipOn3'), + 4 : getAttrByName(characterId, 'critShipOn4'), + 5 : getAttrByName(characterId, 'critShipOn5'), + 6 : getAttrByName(characterId, 'critShipOn6'), + 7 : getAttrByName(characterId, 'critShipOn7'), + 8 : getAttrByName(characterId, 'critShipOn8'), + 9 : getAttrByName(characterId, 'critShipOn9'), + 10 : getAttrByName(characterId, 'critShipOn10'), + 11 : getAttrByName(characterId, 'critShipOn11'), + 12 : getAttrByName(characterId, 'critShipOn12'), + 13 : getAttrByName(characterId, 'critShipOn13'), + 14 : getAttrByName(characterId, 'critShipOn14'), + 15 : getAttrByName(characterId, 'critShipOn15') + } + } + + var critShipRoll = function(addCritNum) { + + // Check for criticals + var critObj = getCritShipID(); + + //add exsiting crits + var totalcrits = 0; + var openSlot = ''; + + for (var key in critObj) { + + if (parseInt(critObj[key]) > 0) { + totalcrits = totalcrits + 1; + } else { + openSlot = key; + //log(openSlot); + } + } + + if (!openSlot) { + sendChat("Alert", "Why are you not dead!"); + return false; + } + + var diceRoll = ''; + var critMod = ''; + var rollTotal = ''; + + //roll random + if (!addCritNum) { + diceRoll = randomInteger(100); + critMod = (totalcrits * 10); + rollTotal = diceRoll + critMod; + } else { + rollTotal = parseInt(addCritNum); + } + + //log(rollTotal); + + //find crit in crital table + for (var key in critShipTable) { + var percent = critShipTable[key].percent.split(' to '); + var low = parseInt(percent[0]); + var high = percent[1] ? parseInt(percent[1]) : 1000; + + if ((rollTotal >= low) && (rollTotal <= high)) { + //openSlot + log(critShipTable[key].name); + + var critNameObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipName'+openSlot, + })[0]; + + var critSeverityObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipSeverity'+openSlot, + })[0]; + + var critRangeObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipRange'+openSlot, + })[0]; + + var critSummaryObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipSummary'+openSlot, + })[0]; + + var critOnObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipOn'+openSlot, + })[0]; + + critNameObj.set({current : critShipTable[key].name}); + critSeverityObj.set({current : critShipTable[key].severity}); + critRangeObj.set({current : critShipTable[key].percent}); + critSummaryObj.set({current : critShipTable[key].Result}); + critOnObj.set({current : openSlot}); + + var chat = '/direct
    Rolls Vehicle Critical
    '; + chat = chat + '
    ';//need new graphic + chat = chat + 'Current Criticals: (' + totalcrits + ' x 10)
    '; + chat = chat + 'Dice Roll: ' + diceRoll + '
    '; + chat = chat + 'Total: ' + rollTotal + '
    '; + chat = chat + '
    '; + chat = chat + '' + critShipTable[key].name + '
    '; + chat = chat + critShipTable[key].Result + '
    '; + + sendChat(characterName, chat); + + } + } + + //use sendChat /direct + html + } + + var critShipHeal = function(critID) { + + var critObj = getCritShipID(); + + for (var key in critObj) { + + if (critObj[key] == critID) { + + var critNameObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipName'+key, + })[0]; + + var critSeverityObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipSeverity'+key, + })[0]; + + var critRangeObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipRange'+key, + })[0]; + + var critSummaryObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipSummary'+key, + })[0]; + + var critOnObj = findObjs({ + type: 'attribute', + characterid: characterId, + name:'critShipOn'+key, + })[0]; + + critNameObj.set({current : null}); + critSeverityObj.set({current : null}); + critRangeObj.set({current : null}); + critSummaryObj.set({current : null}); + critOnObj.set({current : 0}); + + } + } + + } + + //Crit injury + var getCritID = function() { return { @@ -1487,7 +1878,7 @@ var createDicePool = function(msg, who, playerid) { rollTotal = parseInt(addCritNum); } - log(rollTotal); + //log(rollTotal); //find crit in crital table for (var key in critTable) { @@ -1629,6 +2020,31 @@ var createDicePool = function(msg, who, playerid) { } + + + //Create Crit Ship + + var critShipMatch = msg.match(regexCritShip); + + if (critShipMatch) { + // crit(heal|@critName1) + // crit(add|@{critAddRangeNum}) + // crit(roll) + var critArray = critShipMatch[1].split('|'); + var prop1 = critArray[0]; + var prop2 = critArray[1] ? critArray[1] : null; + + if (prop1 == 'heal') { + critShipHeal(prop2); + } else if (prop1 == 'add') { + critShipRoll(prop2); + } else { // crit(roll) + critShipRoll(); + } + + return false;// + } + //Create Crit var critMatch = msg.match(regexCrit); @@ -1650,8 +2066,7 @@ var createDicePool = function(msg, who, playerid) { } return false;// - } - + } //split message on spaces ------------------------------------------ old code split into array @@ -1662,6 +2077,8 @@ var createDicePool = function(msg, who, playerid) { //Settings ------------------------------------------ old code + + processScriptTabs(commandArgv, characterName, rollLabel); //End Settings -------------------------------------- @@ -1924,23 +2341,35 @@ var setupCharacters = function(charObj) { { index: 15, attributes: [ + //crit roll table {name:'critName', current: '', max: '', update: false}, {name:'critSeverity', current: '', max: '', update: false}, {name:'critRange', current: '', max: '', update: false}, {name:'critSummary', current: '', max: '', update: false}, - {name:'critOn', current: '0', max: '', update: false} + {name:'critOn', current: '0', max: '', update: false}, + //ship crit roll table + {name:'critShipName', current: '', max: '', update: false}, + {name:'critShipSeverity', current: '', max: '', update: false}, + {name:'critShipRange', current: '', max: '', update: false}, + {name:'critShipSummary', current: '', max: '', update: false}, + {name:'critShipOn', current: '0', max: '', update: false}, ] }//, ]; var charIDs=_.pluck(charactersObj,'id'); + //log(charIDs); var attrNames = _.pluck(createAttributeList[1].attributes, 'name'); + //log(attrNames); var attrMatcher = new RegExp('^'+createAttributeList[0].name+'$|^'+attrNames.join('|^') ); - + //log(attrMatcher); + var attrs = _.filter(findObjs({type: 'attribute'}), function(a) { return ( _.contains(charIDs, a.get('characterid')) && attrMatcher.test(a.get('name'))); }); - + + //log(attrs); + _.each(charactersObj, function(c) { log('Character: --------------------> ' + c.get('name')); //log('Character ID: --------------------> ' + c.id); diff --git a/StarWarsEdgeOfTheEmpire_Dice/sheet.json b/StarWarsEdgeOfTheEmpire_Dice/sheet.json index 8cde8b8ddb..6d0032fe83 100644 --- a/StarWarsEdgeOfTheEmpire_Dice/sheet.json +++ b/StarWarsEdgeOfTheEmpire_Dice/sheet.json @@ -4,5 +4,5 @@ "authors": "Steve Day", "preview": "EotE-Dice.png", "roll20userid": "446406", - "instructions": "# EotE - Character Sheet v1.5\r Required:\n \u2022\tRoll20 Mentor Subscription\n \u2022\https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.js\n\nv1.5 \u2013 Updates:\n \u2022\tOutput skill name in chat\n \u2022\tOutput character name in chat, so now if you are rolling as the GM from a NPC sheet it will use the character sheet name.\n \u2022\tCritical Injury table - Players can roll criticals from their character sheet and heal (remove criticals). The heal button does not make a Medical check and critical effects are not applied to rolls.\n \u2022\tImproved tab navigation system: Tabs: Character, Skills, Talents, Weapons & Gear\n \u2022\tSkills show which dice to roll.\n\nv1.1 \u2013 Updates:\n \u2022\tSkill tooltips quick reference for skill description and success, advantage, triumph, threat and despair rolls.\n \u2022\tCustom dice input for skills and weapons. Now you can add boost die to your skill. example '1b' = 1 boos. All the dice roll codes from before work (#b #g #y #w #blk #p #r ).\n\u2022\tAdded Encumbrance Threshold and Current. It also adds 1 setback die per rank over characters threshold to you dice pool.\n \u2022\tAdded checkbox click to view 'View Attachments' to weapons to hopefully save some space on the sheet.\n \u2022\tGM Dice Pool\nThe GM Dice Pool allows the GM to set the dice of the dice pool without the other players knowing what was entered. The results will still show for everyone in the chat but the players won't know before the roll what dice was added. \n\nv1.0 \u2013 Updates:\n \u2022\tCharacter sheet\n \u2022\tBasic dice rolls\n \u2022\tTabs\n" + "instructions": "Instructions\": \"# EotE - Character Sheet v2.0\nRequired:\n \u2022\tRoll20 Mentor Subscription\n \u2022 https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/StarWarsEdgeOfTheEmpire_Dice/EotE-Dice.js\n\nv2.0 \u2013 Updates:\n \u2022\tVehicle sheet\n \u2022\tCritical Vehicle table - Players can roll criticals from their character sheet and heal (remove criticals). The heal button does not make a Medical check and critical effects are not applied to rolls.\n \u2022\tPC/NPC initiative roll\n\n\nv1.5 \u2013 Updates:\n \u2022\tOutput skill name in chat\n \u2022\tOutput character name in chat, so now if you are rolling as the GM from a NPC sheet it will use the character sheet name.\n \u2022\tCritical Injury table - Players can roll criticals from their character sheet and heal (remove criticals). The heal button does not make a Medical check and critical effects are not applied to rolls.\n \u2022\tImproved tab navigation system: Tabs: Character, Skills, Talents, Weapons & Gear\n \u2022\tSkills show which dice to roll.\n\nv1.1 \u2013 Updates:\n \u2022\tSkill tooltips quick reference for skill description and success, advantage, triumph, threat and despair rolls.\n \u2022\tCustom dice input for skills and weapons. Now you can add boost die to your skill. example '1b' = 1 boos. All the dice roll codes from before work (#b #g #y #w #blk #p #r ).\n \u2022\tAdded Encumbrance Threshold and Current. It also adds 1 setback die per rank over characters threshold to you dice pool.\n \u2022\tAdded checkbox click to view 'View Attachments' to weapons to hopefully save some space on the sheet.\n \u2022\tGM Dice Pool. The GM Dice Pool allows the GM to set the dice of the dice pool without the other players knowing what was entered. The results will still show for everyone in the chat but the players won't know before the roll what dice was added. \n\nv1.0 \u2013 Updates:\n \u2022\tCharacter sheet\n \u2022\tBasic dice rolls\n \u2022\tTabs" } \ No newline at end of file