Last active
August 12, 2024 16:20
-
-
Save justheuristic/51c87846def1fedac9208225db983348 to your computer and use it in GitHub Desktop.
Generated with versions bokeh - 3.1.1; numpy - 1.23.5; tqdm - 4.64.1 (pip install bokeh==3.1.1 numpy tqdm)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script creates an HTML file that displays success probabilities for Changeling the Dreaming 20th Anniversary Edition. | |
See lines 27-34 for parameters that you might want to change. Note that large num_attempts will slow down the script. | |
You can run the code in a Jupyter Notebook or similar to display the roll table interactively in your notebook. | |
CtD20 differs from prior editions: willpower success can be cancelled by a "1" and speciality grants two successes on 10. | |
If you want to change how this works (e.g. VtM 3e willpower can't be cancelled), find and modify def roll_dice(...) below. | |
License: do whatever you want with this file, see Unlicense for details https://en.wikipedia.org/wiki/Unlicense | |
""" | |
import random | |
from enum import Enum | |
from collections import Counter, defaultdict | |
import tqdm | |
import numpy as np | |
import bokeh | |
from bokeh.models import ColumnDataSource, HoverTool, LabelSet | |
from bokeh.models.widgets import RadioButtonGroup, CheckboxGroup | |
from bokeh.layouts import column, row | |
from bokeh.models.callbacks import CustomJS | |
from bokeh.plotting import figure, output_file, output_notebook, reset_output, show | |
print(f"Versions: bokeh - {bokeh.__version__}\tnumpy - {np.__version__}\ttqdm - {tqdm.__version__}") | |
difficulties = list(range(3, 11)) | |
dice_pools = list(range(1, 11)) | |
num_attempts = 1_000_000 # number of monte-carlo rolls for each situation | |
default_outcome = "1_successes_or_more" | |
output_file_name = "ctd20_roll_table.html" | |
MAX_SUCCESSES = 6 # if changed, also change the number of SUCCESS values in the Outcome enum below | |
class Outcome(Enum): | |
BOTCH, FAILURE, SUCCESS1, SUCCESS2, SUCCESS3, SUCCESS4, SUCCESS5, SUCCESS6_or_more = range(-1, MAX_SUCCESSES + 1) | |
def roll_dice(dice: int, difficulty: int, specialty: bool = False, willpower: bool = False) -> Outcome: | |
""" | |
Roll a dice pool and count the number successes after subtracting all ones and adding special conditions | |
:param specialty: if True, each roll of "10" counts as 2 successes (CtD 20th edition rule) | |
:param willpower: if True, you spent 1 willpower point ahead of time to get one automatic success: | |
""" | |
rolls = [random.randint(1, 10) for _ in range(dice)] | |
successes = sum(roll >= difficulty for roll in rolls) | |
if specialty: # 10s count as two successes | |
successes += sum(roll == 10 for roll in rolls) | |
if willpower: | |
successes += 1 | |
ones = sum(roll == 1 for roll in rolls) | |
if successes == 0 and ones > 0: | |
return Outcome.BOTCH | |
elif successes - ones <= 0: | |
return Outcome.FAILURE | |
elif successes - ones > 0: | |
return Outcome(min(successes - ones, MAX_SUCCESSES)) | |
else: | |
raise RuntimeError("Unexpected outcome") | |
def to_percentage_string(probability: float) -> str: | |
return f"{100 * probability:3.1f}%" | |
############################ | |
# compute monte-carlo data # | |
############################ | |
data_dict = defaultdict(list) | |
with tqdm.trange(len(dice_pools) * len(difficulties) * 4, desc="Gathering statistics...") as progressbar: | |
for dice_pool in dice_pools: | |
for difficulty in difficulties: | |
for willpower in False, True: | |
prefix = "willpower_" if willpower else "" | |
for specialty in False, True: | |
prefix += "specialty_" if specialty else "" | |
data_dict[prefix + 'dice_pool'].append(dice_pool) | |
data_dict[prefix + 'difficulty'].append(difficulty) | |
outcome_counts = Counter((roll_dice(dice_pool, difficulty, specialty, willpower) | |
for _ in range(num_attempts))) | |
data_dict[prefix + 'botch'].append( | |
to_percentage_string(outcome_counts[Outcome.BOTCH] / num_attempts)) | |
data_dict[prefix + 'failure'].append( | |
to_percentage_string(outcome_counts[Outcome.FAILURE] / num_attempts)) | |
for k in range(1, MAX_SUCCESSES + 1): # n^2 loop; can be done in O(n) but im lazy | |
data_dict[f"{prefix}{k}_successes"].append( | |
to_percentage_string(outcome_counts[Outcome(k)] / num_attempts)) | |
data_dict[f"{prefix}{k}_successes_or_more"].append(to_percentage_string( | |
sum(outcome_counts[Outcome(i)] for i in range(k, MAX_SUCCESSES + 1)) / num_attempts | |
)) | |
progressbar.update() | |
assert default_outcome in data_dict | |
data_dict['cell_text'].append(data_dict[default_outcome][-1]) | |
probability = float(data_dict[default_outcome][-1][:-1]) / 100 | |
brightness = hex(min(max(0, int(round(probability * 256))), 255))[2:].rjust(2, "0") | |
assert len(brightness) == 2, "brightness must be a 2-digit hex code" | |
data_dict['cell_color'].append("#" + brightness * 3) | |
data_dict['text_color'].append("#080808" if probability > 0.5 else "#f8f8f8") | |
################################ | |
# Arrange data as a Bokeh plot # | |
################################ | |
reset_output() | |
output_file(output_file_name) | |
if hasattr(__builtins__,'__IPYTHON__'): | |
output_notebook() # show widget if running in a notebook | |
data_source = ColumnDataSource(data=data_dict) | |
hover = HoverTool(tooltips = [ | |
('Dice rolled','@dice_pool'),('Difficulty','@difficulty'), ('Botch', '@botch'), ('Failure', '@failure'), | |
] + [ | |
(f'Success {i}+', f'@{i}_successes_or_more') for i in range(1, MAX_SUCCESSES + 1) | |
] + [(" ", " "), | |
("Willpower 1+", "@willpower_1_successes_or_more"), | |
("Specialty 5+", "@specialty_5_successes_or_more"), | |
("Will+Spec 5+", "@willpower_specialty_5_successes_or_more")]) | |
fig = figure( | |
width=720, height=720, tools=[hover], | |
x_range=(min(difficulties) - 0.5, max(difficulties) + 0.5), | |
y_range=(min(dice_pools) - 0.5, max(dice_pools) + 0.5)) | |
fig.rect(x="difficulty", y="dice_pool", width=1.01, height=1.01, | |
fill_color="cell_color", line_width=0.0, source=data_source, ) | |
fig.add_layout(LabelSet(x='difficulty', y='dice_pool', text="cell_text", text_color="text_color", | |
x_offset=-20, y_offset=-10, text_font_size="12pt", source=data_source,)) | |
fig.xaxis.ticker = difficulties | |
fig.xaxis.axis_label = "Roll difficulty (3 = trivial, 10 = insane)" | |
fig.xaxis.axis_label_text_font_size = "16px" | |
fig.yaxis.ticker = dice_pools | |
fig.yaxis.axis_label = "Dice pool (number of dice rolled)" | |
fig.yaxis.axis_label_text_font_size = "16px" | |
outcome_column_names = ["botch", "failure"] + [f"{i}_successes_or_more" for i in range(1, MAX_SUCCESSES + 1)] | |
outcome_choice = RadioButtonGroup( | |
labels=["Botch", "Failure",] + [f"Success {i}+" for i in range(1, MAX_SUCCESSES + 1)], | |
active=outcome_column_names.index(default_outcome),) | |
options_checkbox = CheckboxGroup(labels=["Willpower", "Specialty"]) | |
callback = CustomJS( | |
args=dict(fig=fig, data_source=data_source, | |
outcome_choice=outcome_choice, options_checkbox=options_checkbox, | |
outcome_column_names=outcome_column_names), | |
code=""" | |
// note: we do not use cb_obj (callback object) to make callback work for multiple objects | |
var data = data_source.data; | |
var chosen_outcome_index = outcome_choice.properties.active._value // int | |
var chosen_option_indices = options_checkbox.properties.active._value // Array[int] | |
var prefix = "" | |
if (chosen_option_indices.includes(0)) prefix += "willpower_" | |
if (chosen_option_indices.includes(1)) prefix += "specialty_" | |
var new_percentage_strings = data[prefix + outcome_column_names[chosen_outcome_index]] | |
for(let i = 0; i < new_percentage_strings.length; i++){ | |
data["cell_text"][i] = new_percentage_strings[i] | |
var percentage = parseFloat(new_percentage_strings[i].slice(0, -1)) | |
var brightness = Math.max(0, Math.min(255, Math.round(percentage * 256 / 100))) | |
data["cell_color"][i] = "#" + brightness.toString(16).padStart(2, "0").repeat(3) | |
if (percentage > 50) data["text_color"][i] = "#080808" | |
else data["text_color"][i] = "#f8f8f8" | |
} | |
data_source.change.emit(); | |
""") | |
outcome_choice.js_on_event("button_click", callback) | |
options_checkbox.js_on_change("active", callback) | |
show(column(row(outcome_choice, options_checkbox), fig)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bokeh Plot</title> | |
<style> | |
html, body { | |
box-sizing: border-box; | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
</style> | |
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-3.1.1.min.js"></script> | |
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.1.1.min.js"></script> | |
<script type="text/javascript"> | |
Bokeh.set_log_level("info"); | |
</script> | |
</head> | |
<body> | |
<div id="b65f5d89-3481-4360-8723-54c31a2eb8dc" data-root-id="p1404" style="display: contents;"></div> | |
<script type="application/json" id="p1460"> | |
{"c43af86a-fcb3-4129-9f83-fd8dd7fa21fc":{"version":"3.1.1","title":"Bokeh Application","defs":[],"roots":[{"type":"object","name":"Column","id":"p1404","attributes":{"children":[{"type":"object","name":"Row","id":"p1403","attributes":{"children":[{"type":"object","name":"RadioButtonGroup","id":"p1400","attributes":{"js_event_callbacks":{"type":"map","entries":[["button_click",[{"type":"object","name":"CustomJS","id":"p1402","attributes":{"args":{"type":"map","entries":[["fig",{"type":"object","name":"Figure","id":"p1350","attributes":{"x_range":{"type":"object","name":"Range1d","id":"p1359","attributes":{"start":2.5,"end":10.5}},"y_range":{"type":"object","name":"Range1d","id":"p1361","attributes":{"start":0.5,"end":10.5}},"x_scale":{"type":"object","name":"LinearScale","id":"p1363"},"y_scale":{"type":"object","name":"LinearScale","id":"p1365"},"title":{"type":"object","name":"Title","id":"p1355"},"renderers":[{"type":"object","name":"GlyphRenderer","id":"p1389","attributes":{"data_source":{"type":"object","name":"ColumnDataSource","id":"p1346","attributes":{"selected":{"type":"object","name":"Selection","id":"p1347","attributes":{"indices":[],"line_indices":[]}},"selection_policy":{"type":"object","name":"UnionRenderers","id":"p1348"},"data":{"type":"map","entries":[["dice_pool",[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10]],["difficulty",[3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10]],["botch",["10.0%","10.0%","10.1%","10.0%","10.0%","10.0%","10.0%","10.0%","3.0%","5.0%","7.0%","9.0%","10.9%","13.0%","15.0%","17.0%","0.7%","1.9%","3.7%","6.1%","9.1%","12.7%","16.9%","21.7%","0.2%","0.6%","1.7%","3.7%","6.7%","11.0%","16.9%","24.6%","0.0%","0.2%","0.8%","2.1%","4.7%","9.0%","16.0%","26.2%","0.0%","0.1%","0.3%","1.2%","3.1%","7.1%","14.4%","26.9%","0.0%","0.0%","0.1%","0.6%","2.0%","5.4%","12.8%","26.9%","0.0%","0.0%","0.1%","0.3%","1.3%","4.1%","11.0%","26.3%","0.0%","0.0%","0.0%","0.2%","0.8%","3.0%","9.4%","25.3%","0.0%","0.0%","0.0%","0.1%","0.5%","2.2%","7.9%","24.2%"]],["failure",["10.0%","20.0%","29.9%","40.0%","50.0%","60.0%","70.0%","80.0%","17.0%","18.0%","21.0%","26.0%","33.1%","42.0%","53.0%","65.9%","7.3%","11.3%","15.3%","20.0%","25.8%","33.3%","43.3%","56.3%","6.1%","8.4%","11.9%","16.2%","21.8%","28.7%","37.8%","49.7%","3.2%","5.7%","9.1%","13.5%","19.1%","26.1%","34.6%","45.4%","2.2%","4.0%","6.9%","11.2%","17.0%","24.3%","32.8%","42.5%","1.3%","2.8%","5.3%","9.3%","15.0%","22.8%","31.8%","41.0%","0.9%","1.9%","4.0%","7.6%","13.4%","21.4%","31.3%","40.2%","0.5%","1.3%","3.0%","6.3%","11.8%","20.2%","30.9%","40.2%","0.3%","0.9%","2.3%","5.1%","10.5%","19.0%","30.5%","40.5%"]],["1_successes",["80.0%","70.0%","60.0%","50.0%","40.0%","30.0%","20.0%","10.0%","16.0%","28.0%","36.0%","40.0%","40.1%","36.0%","28.0%","16.0%","21.6%","23.1%","27.0%","31.4%","34.8%","35.1%","30.6%","19.5%","8.0%","14.0%","19.4%","24.8%","29.6%","32.4%","30.8%","21.5%","7.1%","9.9%","14.3%","19.6%","25.2%","29.5%","30.0%","22.4%","3.5%","6.6%","10.6%","15.6%","21.4%","26.7%","28.8%","22.8%","2.6%","4.6%","7.9%","12.6%","18.3%","24.2%","27.5%","22.8%","1.4%","3.1%","6.0%","10.2%","15.7%","21.9%","26.0%","22.6%","1.0%","2.2%","4.5%","8.2%","13.5%","19.9%","24.8%","22.2%","0.6%","1.5%","3.4%","6.7%","11.7%","18.1%","23.6%","21.8%"]],["1_successes_or_more",["80.0%","70.0%","60.0%","50.0%","40.0%","30.0%","20.0%","10.0%","79.9%","77.0%","71.9%","65.0%","56.0%","45.0%","32.0%","17.0%","92.0%","86.8%","81.0%","73.9%","65.2%","54.0%","39.8%","21.9%","93.8%","90.9%","86.3%","80.1%","71.6%","60.2%","45.2%","25.7%","96.8%","94.0%","90.1%","84.4%","76.2%","64.9%","49.4%","28.4%","97.8%","95.9%","92.8%","87.7%","79.9%","68.7%","52.7%","30.5%","98.7%","97.2%","94.6%","90.1%","83.0%","71.8%","55.5%","32.1%","99.1%","98.1%","95.9%","92.1%","85.3%","74.5%","57.7%","33.5%","99.5%","98.7%","97.0%","93.6%","87.4%","76.7%","59.7%","34.5%","99.7%","99.1%","97.7%","94.8%","89.0%","78.8%","61.6%","35.3%"]],["2_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","63.9%","49.0%","36.0%","25.0%","16.0%","9.0%","4.0%","1.0%","19.2%","29.5%","32.4%","29.9%","24.0%","16.2%","8.4%","2.4%","24.3%","25.4%","28.0%","29.0%","26.6%","20.5%","12.1%","3.9%","10.9%","17.7%","22.7%","26.0%","26.4%","22.6%","14.8%","5.3%","9.3%","13.0%","18.0%","22.5%","24.9%","23.5%","16.8%","6.5%","5.0%","9.2%","14.0%","19.2%","23.1%","23.4%","18.1%","7.6%","3.7%","6.6%","11.0%","16.2%","21.0%","22.7%","18.9%","8.5%","2.2%","4.7%","8.5%","13.6%","18.9%","21.9%","19.3%","9.3%","1.5%","3.3%","6.6%","11.4%","16.9%","20.9%","19.5%","9.9%"]],["2_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","63.9%","49.0%","36.0%","25.0%","16.0%","9.0%","4.0%","1.0%","70.4%","63.7%","54.0%","42.5%","30.4%","18.9%","9.2%","2.5%","85.8%","77.0%","66.9%","55.2%","42.0%","27.8%","14.5%","4.2%","89.7%","84.2%","75.8%","64.8%","51.1%","35.4%","19.4%","6.0%","94.3%","89.4%","82.2%","72.0%","58.5%","42.0%","24.0%","7.7%","96.1%","92.6%","86.7%","77.5%","64.6%","47.6%","28.0%","9.3%","97.7%","94.9%","90.0%","81.9%","69.6%","52.6%","31.7%","10.8%","98.5%","96.5%","92.5%","85.4%","73.9%","56.9%","34.9%","12.2%","99.1%","97.6%","94.3%","88.1%","77.3%","60.6%","38.0%","13.5%"]],["3_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","51.2%","34.2%","21.6%","12.6%","6.4%","2.7%","0.8%","0.1%","20.4%","27.5%","26.0%","20.0%","12.8%","6.5%","2.2%","0.3%","25.7%","25.7%","25.9%","23.1%","17.2%","10.1%","4.0%","0.6%","13.3%","19.9%","23.3%","23.5%","19.8%","13.0%","5.9%","1.1%","11.4%","15.5%","20.0%","22.4%","20.9%","15.3%","7.5%","1.5%","6.7%","11.6%","16.7%","20.5%","21.0%","16.9%","9.1%","2.0%","4.9%","8.7%","13.7%","18.3%","20.5%","17.8%","10.4%","2.5%","3.1%","6.4%","11.0%","16.1%","19.5%","18.4%","11.6%","3.0%"]],["3_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","51.2%","34.2%","21.6%","12.6%","6.4%","2.7%","0.8%","0.1%","61.5%","51.5%","38.9%","26.2%","15.4%","7.3%","2.4%","0.3%","78.9%","66.5%","53.1%","38.8%","24.6%","12.8%","4.6%","0.7%","85.0%","76.4%","64.2%","49.5%","33.6%","18.5%","7.2%","1.2%","91.1%","83.4%","72.7%","58.4%","41.5%","24.2%","9.9%","1.7%","94.0%","88.3%","79.0%","65.7%","48.6%","29.9%","12.8%","2.3%","96.3%","91.8%","84.0%","71.8%","55.0%","35.0%","15.6%","3.0%","97.5%","94.2%","87.8%","76.7%","60.4%","39.7%","18.5%","3.7%"]],["4_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","41.1%","24.1%","12.9%","6.3%","2.6%","0.8%","0.2%","0.0%","20.5%","24.0%","19.5%","12.5%","6.4%","2.4%","0.6%","0.0%","25.8%","24.5%","22.2%","16.9%","10.3%","4.5%","1.2%","0.1%","15.3%","20.9%","22.1%","19.2%","13.4%","6.8%","2.0%","0.2%","13.1%","17.3%","20.4%","20.0%","15.6%","8.9%","2.9%","0.3%","8.3%","13.7%","18.1%","19.7%","17.0%","10.7%","3.9%","0.4%","6.3%","10.6%","15.5%","18.7%","17.7%","12.2%","5.0%","0.6%"]],["4_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","41.1%","24.1%","12.9%","6.3%","2.6%","0.8%","0.2%","0.0%","53.2%","40.8%","27.2%","15.6%","7.4%","2.7%","0.6%","0.0%","71.7%","56.5%","40.9%","26.0%","13.8%","5.5%","1.3%","0.1%","79.8%","67.9%","52.6%","36.0%","20.7%","9.0%","2.4%","0.2%","87.3%","76.7%","62.3%","45.3%","27.7%","12.9%","3.7%","0.3%","91.4%","83.1%","70.3%","53.5%","34.5%","17.1%","5.2%","0.5%","94.4%","87.9%","76.8%","60.6%","40.9%","21.3%","6.9%","0.7%"]],["5_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","32.7%","16.8%","7.7%","3.1%","1.0%","0.2%","0.0%","0.0%","45.9%","32.0%","18.7%","9.1%","3.5%","1.0%","0.1%","0.0%","64.5%","47.0%","30.5%","16.8%","7.3%","2.2%","0.4%","0.0%","74.2%","59.5%","42.0%","25.2%","12.1%","4.0%","0.7%","0.0%","83.1%","69.5%","52.2%","33.8%","17.5%","6.4%","1.3%","0.1%","88.2%","77.2%","61.3%","41.9%","23.2%","9.1%","2.0%","0.1%"]],["5_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","32.7%","16.8%","7.7%","3.1%","1.0%","0.2%","0.0%","0.0%","45.9%","32.0%","18.7%","9.1%","3.5%","1.0%","0.1%","0.0%","64.5%","47.0%","30.5%","16.8%","7.3%","2.2%","0.4%","0.0%","74.2%","59.5%","42.0%","25.2%","12.1%","4.0%","0.7%","0.0%","83.1%","69.5%","52.2%","33.8%","17.5%","6.4%","1.3%","0.1%","88.2%","77.2%","61.3%","41.9%","23.2%","9.1%","2.0%","0.1%"]],["specialty_dice_pool",[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10]],["specialty_difficulty",[3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10]],["specialty_botch",["10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","3.0%","5.0%","7.0%","9.0%","11.0%","13.0%","15.0%","17.0%","0.7%","1.9%","3.7%","6.1%","9.1%","12.8%","16.9%","21.7%","0.1%","0.7%","1.7%","3.6%","6.7%","11.1%","17.0%","24.7%","0.0%","0.2%","0.8%","2.1%","4.7%","9.0%","15.9%","26.3%","0.0%","0.1%","0.3%","1.1%","3.1%","7.1%","14.4%","26.9%","0.0%","0.0%","0.1%","0.6%","2.0%","5.4%","12.7%","26.9%","0.0%","0.0%","0.1%","0.3%","1.3%","4.1%","11.0%","26.2%","0.0%","0.0%","0.0%","0.2%","0.8%","3.0%","9.4%","25.4%","0.0%","0.0%","0.0%","0.1%","0.5%","2.2%","7.9%","24.1%"]],["specialty_failure",["10.0%","20.0%","30.0%","40.0%","50.1%","60.1%","70.0%","80.0%","15.0%","16.0%","19.1%","24.0%","31.0%","40.0%","51.0%","64.0%","6.7%","10.1%","13.5%","17.5%","22.7%","29.7%","39.0%","51.5%","5.1%","7.2%","10.1%","13.9%","18.4%","24.2%","31.7%","41.9%","2.7%","4.7%","7.5%","11.1%","15.5%","20.8%","27.2%","34.8%","1.8%","3.2%","5.6%","9.0%","13.3%","18.7%","24.3%","29.7%","1.0%","2.2%","4.1%","7.2%","11.6%","17.0%","22.4%","26.0%","0.6%","1.4%","3.0%","5.8%","10.1%","15.6%","21.3%","23.6%","0.4%","1.0%","2.2%","4.6%","8.6%","14.3%","20.4%","22.0%","0.2%","0.7%","1.6%","3.7%","7.5%","13.1%","19.6%","21.1%"]],["specialty_1_successes",["70.0%","60.0%","50.0%","40.0%","29.9%","20.0%","10.0%","0.0%","16.0%","26.0%","32.0%","34.0%","32.0%","26.0%","16.0%","2.0%","17.4%","19.1%","22.8%","26.3%","28.2%","26.3%","19.2%","4.8%","7.2%","11.8%","16.0%","20.3%","23.7%","24.7%","20.5%","7.7%","5.4%","7.9%","11.5%","15.7%","19.8%","22.5%","20.8%","10.3%","2.8%","5.2%","8.3%","12.2%","16.5%","20.1%","20.3%","12.4%","1.9%","3.4%","6.0%","9.5%","13.7%","17.9%","19.6%","13.9%","1.1%","2.3%","4.4%","7.4%","11.5%","15.9%","18.5%","15.0%","0.7%","1.6%","3.2%","5.8%","9.6%","14.2%","17.4%","15.6%","0.4%","1.0%","2.3%","4.6%","8.2%","12.6%","16.3%","16.0%"]],["specialty_1_successes_or_more",["80.0%","70.0%","60.0%","50.0%","39.9%","29.9%","19.9%","10.0%","82.0%","79.0%","73.9%","67.0%","58.0%","47.0%","34.0%","19.0%","92.6%","88.0%","82.8%","76.4%","68.2%","57.6%","44.1%","26.8%","94.7%","92.2%","88.2%","82.5%","74.9%","64.7%","51.3%","33.4%","97.3%","95.0%","91.7%","86.8%","79.8%","70.2%","56.9%","38.8%","98.2%","96.7%","94.1%","89.9%","83.6%","74.2%","61.3%","43.4%","99.0%","97.8%","95.8%","92.2%","86.4%","77.6%","64.8%","47.1%","99.4%","98.5%","96.9%","93.8%","88.6%","80.3%","67.7%","50.1%","99.6%","99.0%","97.8%","95.2%","90.6%","82.7%","70.2%","52.6%","99.8%","99.3%","98.4%","96.2%","92.0%","84.6%","72.4%","54.8%"]],["specialty_2_successes",["10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","51.0%","40.0%","30.9%","24.0%","19.0%","16.0%","15.0%","16.0%","19.2%","26.4%","28.3%","26.4%","22.8%","19.2%","17.4%","19.2%","18.5%","20.6%","23.3%","24.4%","23.3%","20.6%","18.5%","20.5%","9.3%","14.1%","18.2%","21.0%","22.0%","20.6%","18.8%","20.7%","6.8%","10.0%","13.9%","17.7%","20.1%","20.1%","18.7%","20.3%","3.9%","6.9%","10.6%","14.6%","17.9%","19.2%","18.4%","19.4%","2.6%","4.7%","8.0%","11.9%","15.7%","18.0%","17.9%","18.5%","1.5%","3.2%","6.0%","9.7%","13.8%","16.8%","17.4%","17.5%","1.0%","2.3%","4.5%","7.9%","11.9%","15.5%","16.7%","16.7%"]],["specialty_2_successes_or_more",["10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","66.0%","53.0%","42.0%","33.0%","26.0%","21.0%","18.0%","17.0%","75.2%","68.9%","60.1%","50.1%","40.0%","31.2%","24.9%","22.0%","87.6%","80.4%","72.1%","62.2%","51.2%","40.1%","30.7%","25.7%","91.9%","87.2%","80.2%","71.1%","60.1%","47.7%","36.1%","28.5%","95.5%","91.5%","85.8%","77.7%","67.1%","54.2%","41.0%","31.0%","97.1%","94.4%","89.7%","82.6%","72.7%","59.7%","45.3%","33.2%","98.3%","96.2%","92.5%","86.4%","77.1%","64.4%","49.3%","35.1%","99.0%","97.5%","94.6%","89.3%","80.9%","68.5%","52.8%","37.0%","99.3%","98.3%","96.0%","91.6%","83.9%","72.1%","56.1%","38.8%"]],["specialty_3_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","14.0%","12.0%","10.0%","8.0%","6.0%","4.0%","2.0%","0.0%","38.8%","29.1%","21.8%","16.3%","12.0%","8.3%","4.6%","0.3%","20.5%","24.7%","23.8%","20.3%","16.0%","11.7%","7.1%","1.0%","18.7%","20.8%","22.0%","21.1%","18.2%","14.3%","9.3%","1.9%","11.0%","15.7%","18.8%","20.0%","18.8%","15.6%","11.0%","3.1%","8.0%","11.7%","15.4%","18.1%","18.5%","16.4%","12.2%","4.3%","4.9%","8.5%","12.4%","15.9%","17.4%","16.7%","13.2%","5.5%","3.3%","6.0%","9.8%","13.6%","16.2%","16.5%","13.7%","6.7%","2.1%","4.3%","7.6%","11.5%","14.8%","16.1%","14.1%","7.7%"]],["specialty_3_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","15.0%","13.0%","11.0%","9.0%","7.0%","5.0%","3.0%","1.0%","56.0%","42.4%","31.8%","23.7%","17.1%","12.0%","7.5%","2.8%","69.1%","59.8%","48.9%","37.8%","27.9%","19.5%","12.3%","5.2%","82.6%","73.1%","61.9%","50.0%","38.0%","27.1%","17.3%","7.9%","88.7%","81.5%","71.9%","59.9%","46.9%","34.0%","22.3%","10.7%","93.3%","87.5%","79.2%","68.1%","54.8%","40.5%","26.9%","13.8%","95.7%","91.6%","84.5%","74.5%","61.3%","46.4%","31.4%","16.7%","97.4%","94.2%","88.6%","79.6%","67.1%","51.8%","35.4%","19.4%","98.4%","96.0%","91.5%","83.7%","72.0%","56.6%","39.4%","22.0%"]],["specialty_4_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","15.0%","11.4%","8.4%","6.0%","4.2%","3.0%","2.4%","2.4%","30.7%","22.5%","16.4%","11.7%","8.0%","5.4%","3.9%","3.8%","20.8%","22.3%","19.7%","15.7%","11.5%","7.8%","5.4%","5.1%","18.7%","20.1%","20.0%","17.6%","13.9%","10.0%","6.7%","6.2%","12.3%","16.4%","18.5%","18.0%","15.4%","11.6%","8.0%","7.0%","9.1%","12.9%","16.1%","17.4%","16.1%","12.9%","9.1%","7.6%","5.9%","9.8%","13.6%","16.1%","16.1%","13.7%","9.9%","8.1%","4.0%","7.3%","11.2%","14.4%","15.7%","14.1%","10.7%","8.3%"]],["specialty_4_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","17.2%","13.3%","10.0%","7.3%","5.2%","3.7%","2.8%","2.5%","48.6%","35.1%","25.1%","17.6%","11.8%","7.8%","5.2%","4.2%","63.9%","52.3%","39.9%","29.0%","19.8%","12.8%","8.1%","6.0%","77.7%","65.9%","53.0%","39.9%","28.1%","18.4%","11.2%","7.7%","85.3%","75.8%","63.7%","49.9%","36.3%","24.1%","14.7%","9.5%","90.8%","83.1%","72.1%","58.6%","43.9%","29.7%","18.2%","11.1%","94.1%","88.2%","78.8%","66.0%","50.9%","35.3%","21.7%","12.7%","96.3%","91.7%","83.9%","72.1%","57.2%","40.5%","25.3%","14.4%"]],["specialty_5_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","2.2%","1.9%","1.6%","1.3%","1.0%","0.7%","0.4%","0.1%","17.9%","12.6%","8.7%","5.9%","3.8%","2.4%","1.3%","0.4%","43.1%","30.0%","20.2%","13.2%","8.3%","5.0%","2.7%","0.8%","59.0%","45.8%","33.0%","22.3%","14.2%","8.4%","4.5%","1.5%","73.0%","59.4%","45.2%","32.0%","20.9%","12.5%","6.7%","2.4%","81.8%","70.2%","56.0%","41.3%","27.8%","16.9%","9.1%","3.5%","88.2%","78.4%","65.3%","49.9%","34.7%","21.6%","11.8%","4.6%","92.2%","84.5%","72.7%","57.7%","41.5%","26.4%","14.6%","6.0%"]],["specialty_5_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","2.2%","1.9%","1.6%","1.3%","1.0%","0.7%","0.4%","0.1%","17.9%","12.6%","8.7%","5.9%","3.8%","2.4%","1.3%","0.4%","43.1%","30.0%","20.2%","13.2%","8.3%","5.0%","2.7%","0.8%","59.0%","45.8%","33.0%","22.3%","14.2%","8.4%","4.5%","1.5%","73.0%","59.4%","45.2%","32.0%","20.9%","12.5%","6.7%","2.4%","81.8%","70.2%","56.0%","41.3%","27.8%","16.9%","9.1%","3.5%","88.2%","78.4%","65.3%","49.9%","34.7%","21.6%","11.8%","4.6%","92.2%","84.5%","72.7%","57.7%","41.5%","26.4%","14.6%","6.0%"]],["willpower_dice_pool",[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10]],["willpower_difficulty",[3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10]],["willpower_botch",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%"]],["willpower_failure",["10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","3.0%","5.0%","7.1%","9.0%","11.0%","12.9%","15.0%","17.0%","3.1%","4.0%","5.5%","7.6%","10.3%","13.5%","17.5%","22.0%","1.4%","2.6%","4.2%","6.3%","9.3%","13.2%","18.7%","25.7%","1.1%","1.9%","3.1%","5.2%","8.3%","12.7%","19.2%","28.4%","0.6%","1.3%","2.4%","4.2%","7.2%","12.0%","19.4%","30.4%","0.4%","0.9%","1.8%","3.5%","6.4%","11.4%","19.3%","32.1%","0.3%","0.6%","1.4%","2.9%","5.6%","10.5%","19.0%","33.4%","0.2%","0.4%","1.1%","2.3%","5.0%","9.9%","18.8%","34.5%","0.1%","0.3%","0.8%","2.0%","4.4%","9.2%","18.5%","35.3%"]],["willpower_1_successes",["10.0%","20.0%","30.0%","40.0%","49.9%","60.0%","70.0%","80.0%","17.0%","18.0%","20.9%","26.0%","33.0%","42.0%","52.9%","66.0%","4.9%","9.2%","13.5%","18.4%","24.5%","32.3%","42.7%","56.1%","4.8%","6.5%","9.4%","13.7%","19.2%","26.5%","36.0%","48.7%","2.1%","4.1%","6.7%","10.4%","15.5%","22.4%","31.4%","43.2%","1.6%","2.8%","4.9%","8.1%","12.8%","19.3%","28.0%","39.1%","0.9%","1.9%","3.6%","6.4%","10.7%","16.9%","25.3%","35.8%","0.6%","1.3%","2.7%","5.1%","9.0%","15.0%","23.2%","33.2%","0.4%","0.9%","2.0%","4.1%","7.7%","13.4%","21.4%","31.1%","0.2%","0.6%","1.5%","3.3%","6.5%","12.0%","20.0%","29.3%"]],["willpower_1_successes_or_more",["90.0%","90.0%","90.0%","90.0%","90.0%","90.0%","90.0%","90.0%","97.0%","95.0%","92.9%","91.0%","89.0%","87.1%","85.0%","83.0%","96.9%","96.0%","94.5%","92.4%","89.7%","86.5%","82.5%","78.0%","98.6%","97.4%","95.8%","93.7%","90.7%","86.8%","81.3%","74.3%","98.9%","98.1%","96.9%","94.8%","91.7%","87.3%","80.8%","71.6%","99.4%","98.7%","97.6%","95.8%","92.8%","88.0%","80.6%","69.6%","99.6%","99.1%","98.2%","96.5%","93.6%","88.6%","80.7%","67.9%","99.7%","99.4%","98.6%","97.1%","94.4%","89.5%","81.0%","66.6%","99.8%","99.6%","98.9%","97.7%","95.0%","90.1%","81.2%","65.5%","99.9%","99.7%","99.2%","98.0%","95.6%","90.8%","81.5%","64.7%"]],["willpower_2_successes",["80.0%","70.0%","60.0%","50.0%","40.1%","30.0%","20.0%","10.0%","16.1%","28.0%","36.1%","40.0%","39.9%","36.0%","28.0%","16.0%","21.6%","23.1%","27.1%","31.5%","34.7%","35.2%","30.6%","19.4%","8.0%","13.9%","19.3%","24.8%","29.6%","32.4%","30.8%","21.4%","7.1%","9.9%","14.3%","19.6%","25.1%","29.5%","29.9%","22.4%","3.5%","6.6%","10.6%","15.6%","21.5%","26.7%","28.7%","22.8%","2.6%","4.6%","7.9%","12.6%","18.3%","24.2%","27.4%","22.8%","1.4%","3.2%","5.9%","10.1%","15.8%","21.9%","26.1%","22.6%","1.0%","2.2%","4.4%","8.2%","13.5%","19.9%","24.8%","22.2%","0.6%","1.5%","3.4%","6.6%","11.7%","18.2%","23.5%","21.8%"]],["willpower_2_successes_or_more",["80.0%","70.0%","60.0%","50.0%","40.1%","30.0%","20.0%","10.0%","80.1%","77.0%","72.1%","65.0%","56.0%","45.0%","32.0%","17.0%","92.0%","86.8%","81.0%","74.0%","65.2%","54.1%","39.8%","21.9%","93.8%","90.9%","86.4%","80.0%","71.5%","60.3%","45.3%","25.6%","96.8%","94.0%","90.1%","84.4%","76.2%","64.9%","49.4%","28.4%","97.8%","95.9%","92.7%","87.6%","80.0%","68.7%","52.7%","30.5%","98.7%","97.2%","94.6%","90.2%","82.9%","71.7%","55.5%","32.1%","99.2%","98.1%","96.0%","92.0%","85.3%","74.5%","57.7%","33.4%","99.5%","98.7%","97.0%","93.6%","87.3%","76.8%","59.8%","34.4%","99.7%","99.1%","97.7%","94.7%","89.1%","78.8%","61.5%","35.4%"]],["willpower_3_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","64.0%","49.0%","36.0%","25.0%","16.0%","9.0%","4.0%","1.0%","19.2%","29.4%","32.4%","30.0%","24.0%","16.2%","8.4%","2.4%","24.3%","25.5%","28.1%","29.0%","26.5%","20.6%","12.1%","3.9%","10.9%","17.6%","22.7%","26.0%","26.4%","22.7%","14.9%","5.3%","9.4%","13.0%","18.0%","22.5%","24.9%","23.4%","16.8%","6.5%","5.0%","9.2%","14.1%","19.2%","23.0%","23.3%","18.1%","7.6%","3.7%","6.6%","11.0%","16.2%","20.9%","22.8%","18.9%","8.5%","2.2%","4.7%","8.4%","13.6%","18.8%","21.9%","19.4%","9.3%","1.5%","3.3%","6.6%","11.3%","17.0%","21.0%","19.6%","9.9%"]],["willpower_3_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","64.0%","49.0%","36.0%","25.0%","16.0%","9.0%","4.0%","1.0%","70.4%","63.7%","54.0%","42.5%","30.5%","18.9%","9.2%","2.5%","85.8%","77.0%","67.1%","55.2%","41.9%","27.8%","14.5%","4.2%","89.8%","84.1%","75.8%","64.8%","51.1%","35.4%","19.5%","6.0%","94.3%","89.3%","82.1%","72.0%","58.5%","42.0%","24.0%","7.7%","96.1%","92.6%","86.7%","77.5%","64.6%","47.5%","28.0%","9.3%","97.7%","94.9%","90.1%","81.9%","69.5%","52.6%","31.7%","10.8%","98.5%","96.5%","92.5%","85.4%","73.8%","56.8%","35.0%","12.2%","99.1%","97.5%","94.3%","88.1%","77.3%","60.6%","38.0%","13.6%"]],["willpower_4_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","51.2%","34.3%","21.6%","12.5%","6.4%","2.7%","0.8%","0.1%","20.5%","27.5%","26.0%","20.0%","12.8%","6.5%","2.2%","0.3%","25.6%","25.7%","25.9%","23.1%","17.3%","10.1%","4.0%","0.6%","13.3%","19.9%","23.3%","23.5%","19.9%","13.1%","5.8%","1.1%","11.3%","15.5%","20.1%","22.3%","20.9%","15.3%","7.6%","1.5%","6.7%","11.6%","16.7%","20.5%","21.1%","17.0%","9.1%","2.0%","4.9%","8.7%","13.6%","18.3%","20.5%","17.8%","10.4%","2.5%","3.1%","6.4%","11.0%","16.1%","19.5%","18.3%","11.5%","3.0%"]],["willpower_4_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","51.2%","34.3%","21.6%","12.5%","6.4%","2.7%","0.8%","0.1%","61.4%","51.5%","39.0%","26.2%","15.4%","7.3%","2.4%","0.3%","78.9%","66.5%","53.1%","38.8%","24.7%","12.8%","4.6%","0.7%","84.9%","76.3%","64.1%","49.5%","33.6%","18.6%","7.2%","1.2%","91.1%","83.4%","72.6%","58.3%","41.6%","24.2%","9.9%","1.7%","94.0%","88.2%","79.1%","65.7%","48.7%","29.8%","12.8%","2.3%","96.3%","91.8%","84.1%","71.8%","55.0%","34.9%","15.6%","2.9%","97.5%","94.2%","87.7%","76.8%","60.4%","39.6%","18.4%","3.7%"]],["willpower_5_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","41.0%","24.0%","13.0%","6.2%","2.5%","0.8%","0.2%","0.0%","53.2%","40.8%","27.2%","15.7%","7.4%","2.7%","0.6%","0.0%","71.6%","56.5%","40.8%","26.0%","13.7%","5.5%","1.3%","0.1%","79.8%","67.9%","52.5%","36.0%","20.7%","8.9%","2.4%","0.2%","87.3%","76.6%","62.4%","45.2%","27.6%","12.9%","3.7%","0.3%","91.3%","83.1%","70.4%","53.5%","34.5%","17.1%","5.2%","0.5%","94.4%","87.8%","76.7%","60.7%","40.9%","21.3%","6.9%","0.7%"]],["willpower_5_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","41.0%","24.0%","13.0%","6.2%","2.5%","0.8%","0.2%","0.0%","53.2%","40.8%","27.2%","15.7%","7.4%","2.7%","0.6%","0.0%","71.6%","56.5%","40.8%","26.0%","13.7%","5.5%","1.3%","0.1%","79.8%","67.9%","52.5%","36.0%","20.7%","8.9%","2.4%","0.2%","87.3%","76.6%","62.4%","45.2%","27.6%","12.9%","3.7%","0.3%","91.3%","83.1%","70.4%","53.5%","34.5%","17.1%","5.2%","0.5%","94.4%","87.8%","76.7%","60.7%","40.9%","21.3%","6.9%","0.7%"]],["willpower_specialty_dice_pool",[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10]],["willpower_specialty_difficulty",[3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10]],["willpower_specialty_botch",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%"]],["willpower_specialty_failure",["10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","3.0%","5.0%","7.0%","9.0%","11.0%","13.0%","15.1%","17.0%","2.8%","3.7%","5.2%","7.3%","10.0%","13.3%","17.2%","21.6%","1.3%","2.4%","3.8%","5.8%","8.7%","12.7%","17.9%","24.7%","0.9%","1.6%","2.7%","4.6%","7.5%","11.6%","17.7%","26.5%","0.5%","1.1%","2.0%","3.7%","6.3%","10.5%","17.2%","27.4%","0.3%","0.7%","1.5%","2.9%","5.4%","9.5%","16.5%","27.7%","0.2%","0.5%","1.1%","2.3%","4.6%","8.6%","15.7%","27.6%","0.1%","0.3%","0.8%","1.8%","3.9%","7.8%","14.9%","27.3%","0.1%","0.2%","0.6%","1.5%","3.3%","7.0%","14.0%","26.8%"]],["willpower_specialty_1_successes",["10.0%","20.0%","30.0%","40.0%","50.0%","60.0%","70.0%","80.0%","15.0%","15.9%","19.1%","24.0%","31.0%","40.0%","50.9%","64.0%","4.6%","8.3%","11.9%","16.3%","21.9%","29.1%","38.7%","51.7%","3.9%","5.4%","8.0%","11.7%","16.5%","22.6%","30.8%","41.9%","1.8%","3.4%","5.6%","8.6%","12.8%","18.2%","25.3%","34.7%","1.2%","2.2%","3.9%","6.5%","10.2%","15.2%","21.5%","29.3%","0.7%","1.4%","2.8%","5.0%","8.2%","12.9%","18.7%","25.2%","0.4%","0.9%","2.0%","3.8%","6.7%","11.1%","16.6%","22.4%","0.3%","0.6%","1.4%","3.0%","5.6%","9.6%","15.0%","20.1%","0.2%","0.4%","1.0%","2.3%","4.6%","8.4%","13.6%","18.4%"]],["willpower_specialty_1_successes_or_more",["90.0%","90.0%","90.0%","90.0%","90.0%","90.0%","90.0%","90.0%","97.0%","95.0%","93.0%","91.0%","89.0%","87.0%","84.9%","83.0%","97.2%","96.3%","94.8%","92.7%","90.0%","86.7%","82.8%","78.4%","98.7%","97.6%","96.2%","94.2%","91.3%","87.3%","82.1%","75.3%","99.1%","98.4%","97.3%","95.4%","92.5%","88.4%","82.3%","73.5%","99.5%","98.9%","98.0%","96.3%","93.7%","89.5%","82.8%","72.6%","99.7%","99.3%","98.5%","97.1%","94.6%","90.5%","83.5%","72.3%","99.8%","99.5%","98.9%","97.7%","95.4%","91.4%","84.3%","72.4%","99.9%","99.7%","99.2%","98.2%","96.1%","92.2%","85.1%","72.7%","99.9%","99.8%","99.4%","98.5%","96.7%","93.0%","86.0%","73.2%"]],["willpower_specialty_2_successes",["70.0%","60.0%","50.0%","40.0%","30.1%","20.0%","10.0%","0.0%","16.0%","26.0%","32.0%","33.9%","32.0%","26.0%","16.0%","2.0%","17.4%","19.2%","22.8%","26.4%","28.2%","26.4%","19.2%","4.8%","7.1%","11.7%","16.1%","20.4%","23.8%","24.7%","20.5%","7.7%","5.4%","7.8%","11.5%","15.7%","19.8%","22.5%","20.8%","10.2%","2.8%","5.2%","8.2%","12.2%","16.6%","20.1%","20.3%","12.3%","1.9%","3.4%","6.0%","9.5%","13.8%","17.8%","19.5%","13.9%","1.1%","2.3%","4.4%","7.4%","11.5%","15.9%","18.5%","15.0%","0.7%","1.5%","3.2%","5.9%","9.6%","14.1%","17.4%","15.6%","0.4%","1.1%","2.3%","4.6%","8.1%","12.6%","16.4%","15.9%"]],["willpower_specialty_2_successes_or_more",["80.0%","70.1%","60.0%","50.0%","40.0%","30.0%","20.0%","10.0%","81.9%","79.0%","74.0%","67.0%","57.9%","47.0%","34.0%","19.0%","92.6%","88.0%","82.8%","76.4%","68.1%","57.6%","44.0%","26.7%","94.8%","92.2%","88.2%","82.5%","74.9%","64.8%","51.2%","33.4%","97.3%","95.0%","91.7%","86.8%","79.7%","70.1%","57.0%","38.9%","98.3%","96.7%","94.1%","89.8%","83.5%","74.3%","61.3%","43.3%","99.0%","97.9%","95.7%","92.1%","86.4%","77.5%","64.8%","47.1%","99.4%","98.6%","96.9%","93.8%","88.7%","80.4%","67.7%","50.0%","99.6%","99.0%","97.8%","95.2%","90.5%","82.6%","70.2%","52.7%","99.8%","99.3%","98.4%","96.2%","92.1%","84.6%","72.4%","54.8%"]],["willpower_specialty_3_successes",["10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","51.0%","40.0%","31.0%","24.1%","19.0%","16.0%","15.0%","16.0%","19.2%","26.4%","28.3%","26.4%","22.7%","19.2%","17.4%","19.1%","18.4%","20.5%","23.3%","24.3%","23.1%","20.5%","18.5%","20.5%","9.3%","14.2%","18.2%","21.0%","21.9%","20.6%","18.9%","20.7%","6.7%","10.0%","14.0%","17.7%","20.0%","20.1%","18.7%","20.2%","3.8%","6.8%","10.6%","14.6%","17.9%","19.2%","18.4%","19.4%","2.5%","4.7%","8.0%","11.9%","15.7%","18.0%","17.9%","18.5%","1.5%","3.3%","6.0%","9.8%","13.8%","16.7%","17.3%","17.6%","1.0%","2.2%","4.5%","7.9%","12.0%","15.5%","16.7%","16.7%"]],["willpower_specialty_3_successes_or_more",["10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","10.0%","65.9%","53.0%","42.0%","33.1%","26.0%","21.0%","18.0%","17.0%","75.3%","68.8%","60.0%","50.0%","39.9%","31.2%","24.8%","22.0%","87.7%","80.5%","72.1%","62.1%","51.1%","40.1%","30.8%","25.7%","91.8%","87.2%","80.2%","71.1%","60.0%","47.7%","36.3%","28.7%","95.5%","91.6%","85.8%","77.6%","66.9%","54.3%","41.0%","30.9%","97.1%","94.4%","89.7%","82.6%","72.6%","59.7%","45.2%","33.2%","98.3%","96.3%","92.5%","86.4%","77.2%","64.5%","49.2%","35.0%","98.9%","97.5%","94.6%","89.3%","80.9%","68.5%","52.8%","37.0%","99.4%","98.3%","96.0%","91.6%","84.0%","72.1%","56.0%","38.8%"]],["willpower_specialty_4_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","14.0%","12.0%","9.9%","8.0%","6.0%","4.0%","2.0%","0.0%","38.9%","29.0%","21.7%","16.3%","12.0%","8.3%","4.6%","0.3%","20.5%","24.7%","23.8%","20.3%","16.1%","11.8%","7.1%","0.9%","18.7%","20.7%","22.0%","21.1%","18.2%","14.3%","9.3%","1.9%","11.0%","15.7%","18.9%","19.9%","18.8%","15.7%","11.0%","3.1%","8.0%","11.6%","15.4%","18.1%","18.4%","16.4%","12.3%","4.3%","4.9%","8.5%","12.3%","15.9%","17.6%","16.6%","13.1%","5.5%","3.3%","6.0%","9.8%","13.6%","16.2%","16.5%","13.8%","6.7%","2.1%","4.3%","7.6%","11.5%","14.8%","16.0%","14.1%","7.7%"]],["willpower_specialty_4_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","15.0%","13.0%","10.9%","9.0%","7.0%","5.0%","3.0%","1.0%","56.1%","42.4%","31.8%","23.6%","17.2%","12.0%","7.4%","2.8%","69.2%","59.9%","48.8%","37.8%","27.9%","19.6%","12.3%","5.2%","82.5%","72.9%","62.0%","50.0%","38.0%","27.1%","17.4%","7.9%","88.7%","81.6%","71.9%","59.9%","46.9%","34.2%","22.3%","10.7%","93.3%","87.6%","79.1%","68.0%","54.7%","40.5%","26.9%","13.8%","95.8%","91.5%","84.6%","74.5%","61.5%","46.5%","31.3%","16.6%","97.4%","94.2%","88.6%","79.5%","67.1%","51.8%","35.5%","19.4%","98.4%","96.0%","91.5%","83.7%","72.0%","56.6%","39.2%","22.1%"]],["willpower_specialty_5_successes",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","17.2%","13.4%","10.0%","7.3%","5.2%","3.7%","2.8%","2.5%","48.7%","35.3%","25.1%","17.5%","11.9%","7.8%","5.2%","4.2%","63.8%","52.2%","40.0%","28.9%","19.9%","12.8%","8.1%","6.0%","77.7%","65.9%","53.0%","40.0%","28.1%","18.5%","11.3%","7.7%","85.3%","76.0%","63.7%","50.0%","36.3%","24.1%","14.6%","9.4%","90.9%","83.0%","72.2%","58.6%","43.9%","29.8%","18.2%","11.0%","94.1%","88.2%","78.8%","66.0%","50.9%","35.3%","21.7%","12.7%","96.3%","91.7%","83.9%","72.2%","57.2%","40.6%","25.1%","14.4%"]],["willpower_specialty_5_successes_or_more",["0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","0.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","1.0%","17.2%","13.4%","10.0%","7.3%","5.2%","3.7%","2.8%","2.5%","48.7%","35.3%","25.1%","17.5%","11.9%","7.8%","5.2%","4.2%","63.8%","52.2%","40.0%","28.9%","19.9%","12.8%","8.1%","6.0%","77.7%","65.9%","53.0%","40.0%","28.1%","18.5%","11.3%","7.7%","85.3%","76.0%","63.7%","50.0%","36.3%","24.1%","14.6%","9.4%","90.9%","83.0%","72.2%","58.6%","43.9%","29.8%","18.2%","11.0%","94.1%","88.2%","78.8%","66.0%","50.9%","35.3%","21.7%","12.7%","96.3%","91.7%","83.9%","72.2%","57.2%","40.6%","25.1%","14.4%"]],["cell_text",["80.0%","70.0%","60.0%","50.0%","40.0%","30.0%","20.0%","10.0%","79.9%","77.0%","71.9%","65.0%","56.0%","45.0%","32.0%","17.0%","92.0%","86.8%","81.0%","73.9%","65.2%","54.0%","39.8%","21.9%","93.8%","90.9%","86.3%","80.1%","71.6%","60.2%","45.2%","25.7%","96.8%","94.0%","90.1%","84.4%","76.2%","64.9%","49.4%","28.4%","97.8%","95.9%","92.8%","87.7%","79.9%","68.7%","52.7%","30.5%","98.7%","97.2%","94.6%","90.1%","83.0%","71.8%","55.5%","32.1%","99.1%","98.1%","95.9%","92.1%","85.3%","74.5%","57.7%","33.5%","99.5%","98.7%","97.0%","93.6%","87.4%","76.7%","59.7%","34.5%","99.7%","99.1%","97.7%","94.8%","89.0%","78.8%","61.6%","35.3%"]],["cell_color",["#cdcdcd","#b3b3b3","#9a9a9a","#808080","#666666","#4d4d4d","#333333","#1a1a1a","#cdcdcd","#c5c5c5","#b8b8b8","#a6a6a6","#8f8f8f","#737373","#525252","#2c2c2c","#ececec","#dedede","#cfcfcf","#bdbdbd","#a7a7a7","#8a8a8a","#666666","#383838","#f0f0f0","#e9e9e9","#dddddd","#cdcdcd","#b7b7b7","#9a9a9a","#747474","#424242","#f8f8f8","#f1f1f1","#e7e7e7","#d8d8d8","#c3c3c3","#a6a6a6","#7e7e7e","#494949","#fafafa","#f6f6f6","#eeeeee","#e1e1e1","#cdcdcd","#b0b0b0","#878787","#4e4e4e","#fdfdfd","#f9f9f9","#f2f2f2","#e7e7e7","#d4d4d4","#b8b8b8","#8e8e8e","#525252","#fefefe","#fbfbfb","#f6f6f6","#ececec","#dadada","#bfbfbf","#949494","#565656","#ffffff","#fdfdfd","#f8f8f8","#f0f0f0","#e0e0e0","#c4c4c4","#999999","#585858","#ffffff","#fefefe","#fafafa","#f3f3f3","#e4e4e4","#cacaca","#9e9e9e","#5a5a5a"]],["text_color",["#080808","#080808","#080808","#f8f8f8","#f8f8f8","#f8f8f8","#f8f8f8","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#f8f8f8","#f8f8f8","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#080808","#f8f8f8","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#080808","#f8f8f8","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#080808","#f8f8f8","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#080808","#080808","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#080808","#080808","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#080808","#080808","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#080808","#080808","#f8f8f8","#080808","#080808","#080808","#080808","#080808","#080808","#080808","#f8f8f8"]]]}}},"view":{"type":"object","name":"CDSView","id":"p1390","attributes":{"filter":{"type":"object","name":"AllIndices","id":"p1391"}}},"glyph":{"type":"object","name":"Rect","id":"p1386","attributes":{"x":{"type":"field","field":"difficulty"},"y":{"type":"field","field":"dice_pool"},"width":{"type":"value","value":1.01},"height":{"type":"value","value":1.01},"line_color":{"type":"value","value":"#1f77b4"},"line_width":{"type":"value","value":0.0},"fill_color":{"type":"field","field":"cell_color"}}},"nonselection_glyph":{"type":"object","name":"Rect","id":"p1387","attributes":{"x":{"type":"field","field":"difficulty"},"y":{"type":"field","field":"dice_pool"},"width":{"type":"value","value":1.01},"height":{"type":"value","value":1.01},"line_color":{"type":"value","value":"#1f77b4"},"line_alpha":{"type":"value","value":0.1},"line_width":{"type":"value","value":0.0},"fill_color":{"type":"field","field":"cell_color"},"fill_alpha":{"type":"value","value":0.1},"hatch_alpha":{"type":"value","value":0.1}}},"muted_glyph":{"type":"object","name":"Rect","id":"p1388","attributes":{"x":{"type":"field","field":"difficulty"},"y":{"type":"field","field":"dice_pool"},"width":{"type":"value","value":1.01},"height":{"type":"value","value":1.01},"line_color":{"type":"value","value":"#1f77b4"},"line_alpha":{"type":"value","value":0.2},"line_width":{"type":"value","value":0.0},"fill_color":{"type":"field","field":"cell_color"},"fill_alpha":{"type":"value","value":0.2},"hatch_alpha":{"type":"value","value":0.2}}}}}],"toolbar":{"type":"object","name":"Toolbar","id":"p1357","attributes":{"tools":[{"type":"object","name":"HoverTool","id":"p1349","attributes":{"renderers":"auto","tooltips":[["Dice rolled","@dice_pool"],["Difficulty","@difficulty"],["Botch:","@botch"],["Failure:","@failure"],["Success 1+","@1_successes_or_more"],["Success 2+","@2_successes_or_more"],["Success 3+","@3_successes_or_more"],["Success 4+","@4_successes_or_more"],["Success 5+","@5_successes_or_more"],[" "," "],["Willpower 1+","@willpower_1_successes_or_more"],["Specialty 5+","@specialty_5_successes_or_more"],["Will+Spec 5+","@willpower_specialty_5_successes_or_more"]]}}]}},"left":[{"type":"object","name":"LinearAxis","id":"p1374","attributes":{"ticker":{"type":"object","name":"FixedTicker","id":"p1398","attributes":{"ticks":[1,2,3,4,5,6,7,8,9,10],"minor_ticks":[]}},"formatter":{"type":"object","name":"BasicTickFormatter","id":"p1376"},"axis_label":"Dice pool (number of dice rolled)","major_label_policy":{"type":"object","name":"AllLabels","id":"p1377"}}}],"below":[{"type":"object","name":"LinearAxis","id":"p1367","attributes":{"ticker":{"type":"object","name":"FixedTicker","id":"p1396","attributes":{"ticks":[3,4,5,6,7,8,9,10],"minor_ticks":[]}},"formatter":{"type":"object","name":"BasicTickFormatter","id":"p1369"},"axis_label":"Roll difficulty (3 = easy, 10 = insane)","major_label_policy":{"type":"object","name":"AllLabels","id":"p1370"}}}],"center":[{"type":"object","name":"Grid","id":"p1373","attributes":{"axis":{"id":"p1367"}}},{"type":"object","name":"Grid","id":"p1380","attributes":{"dimension":1,"axis":{"id":"p1374"}}},{"type":"object","name":"LabelSet","id":"p1392","attributes":{"source":{"id":"p1346"},"x":{"type":"field","field":"difficulty"},"y":{"type":"field","field":"dice_pool"},"text":{"type":"field","field":"cell_text"},"x_offset":{"type":"value","value":-20},"y_offset":{"type":"value","value":-10},"text_color":{"type":"field","field":"text_color"},"text_font_size":{"type":"value","value":"11pt"}}}]}}],["data_source",{"id":"p1346"}],["outcome_choice",{"id":"p1400"}],["options_checkbox",{"type":"object","name":"CheckboxGroup","id":"p1401","attributes":{"js_property_callbacks":{"type":"map","entries":[["change:active",[{"id":"p1402"}]]]},"labels":["Willpower","Specialty"]}}],["outcome_column_names",["botch","failure","1_successes_or_more","2_successes_or_more","3_successes_or_more","4_successes_or_more","5_successes_or_more"]]]},"code":"\n // note: we do not use cb_obj (callback object) to make callback work for multiple objects\n var data = data_source.data; \n var chosen_outcome_index = outcome_choice.properties.active._value // int\n var chosen_option_indices = options_checkbox.properties.active._value // Array[int]\n \n var prefix = \"\"\n if (chosen_option_indices.includes(0)) prefix += \"willpower_\"\n if (chosen_option_indices.includes(1)) prefix += \"specialty_\"\n \n var new_percentage_strings = data[prefix + outcome_column_names[chosen_outcome_index]]\n \n for(let i = 0; i < new_percentage_strings.length; i++){\n data[\"cell_text\"][i] = new_percentage_strings[i]\n var percentage = parseFloat(new_percentage_strings[i].slice(0, -1))\n var brightness = Math.max(0, Math.min(255, Math.round(percentage * 256 / 100)))\n data[\"cell_color\"][i] = \"#\" + brightness.toString(16).padStart(2, \"0\").repeat(3)\n if (percentage > 50) data[\"text_color\"][i] = \"#080808\"\n else data[\"text_color\"][i] = \"#f8f8f8\"\n }\n data_source.change.emit();\n "}}]]]},"labels":["Botch","Failure","Success 1+","Success 2+","Success 3+","Success 4+","Success 5+"],"active":2}},{"id":"p1401"}]}},{"id":"p1350"}]}}],"callbacks":{"type":"map"}}} | |
</script> | |
<script type="text/javascript"> | |
(function() { | |
const fn = function() { | |
Bokeh.safely(function() { | |
(function(root) { | |
function embed_document(root) { | |
const docs_json = document.getElementById('p1460').textContent; | |
const render_items = [{"docid":"c43af86a-fcb3-4129-9f83-fd8dd7fa21fc","roots":{"p1404":"b65f5d89-3481-4360-8723-54c31a2eb8dc"},"root_ids":["p1404"]}]; | |
root.Bokeh.embed.embed_items(docs_json, render_items); | |
} | |
if (root.Bokeh !== undefined) { | |
embed_document(root); | |
} else { | |
let attempts = 0; | |
const timer = setInterval(function(root) { | |
if (root.Bokeh !== undefined) { | |
clearInterval(timer); | |
embed_document(root); | |
} else { | |
attempts++; | |
if (attempts > 100) { | |
clearInterval(timer); | |
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing"); | |
} | |
} | |
}, 10, root) | |
} | |
})(window); | |
}); | |
}; | |
if (document.readyState != "loading") fn(); | |
else document.addEventListener("DOMContentLoaded", fn); | |
})(); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alternative drawing code that arranges the data in a more compact manner, friendly for horizontal smartphone screens | |
# To enable this mode, find the # Arrange data as a Bokeh plot" comment and replace the code after this comment with the code below: | |
################################ | |
# Arrange data as a Bokeh plot # | |
################################ | |
reset_output() | |
output_file(output_file_name) | |
if hasattr(__builtins__,'__IPYTHON__'): | |
output_notebook() # show widget if running in a notebook | |
data_source = ColumnDataSource(data=data_dict) | |
hover = HoverTool(tooltips = [ | |
('Dice rolled', '@dice_pool'), ('Difficulty', '@difficulty'), ('Botch', '@botch'), ('Failure', '@failure'), | |
] + [ | |
(f'Success {i}+', f'@{i}_successes_or_more') for i in range(1, MAX_SUCCESSES + 1) | |
] + [(" ", " "), | |
("Willpower 1+", "@willpower_1_successes_or_more"), | |
("Specialty 5+", "@specialty_5_successes_or_more"), | |
("Will+Spec 5+", "@willpower_specialty_5_successes_or_more")]) | |
fig = figure( | |
width=480, height=480, tools=[hover], | |
x_range=(min(difficulties) - 0.5, max(difficulties) + 0.5), | |
y_range=(min(dice_pools) - 0.5, max(dice_pools) + 0.5), | |
) | |
fig.toolbar_location = None | |
fig.rect(x="difficulty", y="dice_pool", width=1.01, height=1.01, | |
fill_color="cell_color", line_width=0.0, source=data_source, ) | |
fig.add_layout(LabelSet(x='difficulty', y='dice_pool', text="cell_text", text_color="text_color", | |
x_offset=-18, y_offset=-8, text_font_size="10pt", source=data_source,)) | |
fig.xaxis.ticker = difficulties | |
fig.xaxis.axis_label = "Roll difficulty (3 = trivial, 10 = insane)" | |
fig.xaxis.axis_label_text_font_size = "16px" | |
fig.yaxis.ticker = dice_pools | |
fig.yaxis.axis_label = "Dice pool (number of dice rolled)" | |
fig.yaxis.axis_label_text_font_size = "16px" | |
outcome_column_names = ["botch", "failure"] + [f"{i}_successes_or_more" for i in range(1, MAX_SUCCESSES + 1)] | |
outcome_choice = RadioButtonGroup( | |
labels=["Botch", "Failure",] + [f"Success {i}+" for i in range(1, MAX_SUCCESSES + 1)], | |
active=outcome_column_names.index(default_outcome), orientation='vertical', height=380, height_policy="fixed") | |
options_checkbox = CheckboxGroup(labels=["Willpower", "Specialty"]) | |
callback = CustomJS( | |
args=dict(fig=fig, data_source=data_source, | |
outcome_choice=outcome_choice, options_checkbox=options_checkbox, | |
outcome_column_names=outcome_column_names), | |
code=""" | |
// note: we do not use cb_obj (callback object) to make callback work for multiple objects | |
var data = data_source.data; | |
var chosen_outcome_index = outcome_choice.properties.active._value // int | |
var chosen_option_indices = options_checkbox.properties.active._value // Array[int] | |
var prefix = "" | |
if (chosen_option_indices.includes(0)) prefix += "willpower_" | |
if (chosen_option_indices.includes(1)) prefix += "specialty_" | |
var new_percentage_strings = data[prefix + outcome_column_names[chosen_outcome_index]] | |
for(let i = 0; i < new_percentage_strings.length; i++){ | |
data["cell_text"][i] = new_percentage_strings[i] | |
var percentage = parseFloat(new_percentage_strings[i].slice(0, -1)) | |
var brightness = Math.max(0, Math.min(255, Math.round(percentage * 256 / 100))) | |
data["cell_color"][i] = "#" + brightness.toString(16).padStart(2, "0").repeat(3) | |
if (percentage > 50) data["text_color"][i] = "#080808" | |
else data["text_color"][i] = "#f8f8f8" | |
} | |
data_source.change.emit(); | |
""") | |
outcome_choice.js_on_event("button_click", callback) | |
options_checkbox.js_on_change("active", callback) | |
show(row(fig, column(outcome_choice, options_checkbox))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment