C&C - Level

This chart uses input variables
Result

Level {$levelnumber}

{% rolled_row = roll_chart cols:1 name:"C&C - LevelSize" %}
{% levelsize = rolled_row.Result.value %}
{# --- levelsize is required number of rooms, excluding corridors
--- we try twice as many times, assuming this will result in at least levelsize rooms #}

{% attempts = {2*{$levelsize}} %}
{% roomcount = 0 %}
{%for i in range from:1 to:attempts%}
{# --- only do these statements while we've not reached the required number of rooms #}
{%if roomcount < levelsize%}
{% segnumber = i %}
{% segtype = {1-2?Corr|3-6?Room} %}
{%if segtype == "Room"%}
{% roomcount = {{$roomcount} + 1} %}
{%end%}
{%if roomcount == levelsize%}
{%if levelnumber == dungeonsize%}
{% roomtype = "questlast" %}
{%else%}
{% roomtype = "levellast" %}
{%end%}
{%else%}
{% roomtype = "normal" %}
{%end%}
Roll on "C&C - Segment"
{%end%}
{%end%}

Subcharts

C&C - LevelSize (2d6)

2d6 Result

2-6

Roll 1d6 + 4

7-9

Roll 1d6 + 8

10-11

Roll 2d6 + 12

12

Roll 3d6 + 16