JSFiddle - React, Tailwind, and code Playground

by Vindexus

HTML

<input type="text" id="num" size="3" value="10" /><button id="go">Go</button>
<ul id="items">
</ul>

JavaScript

//{ongoing_bonus}
//{global_restriction} {ongoing_bonus}
//{targetted_ability} {ability_uses}
//{self_ability} {ability_uses}
//{against_bonus} {target}
//{global_restiction} {targetted_ability} {ability_uses}
//{global_restiction} {self_ability} {ability_uses}
//{global_restiction} {against_bonus} {target} {ability_uses}

var piece_lists = {};

function shuffle(o){
    for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
    return o;
}

function cfl(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
}

function get_random_item(arr) {
    return arr[Math.floor(Math.random() * arr.length)];
}

function get_random_piece(key) {
    return get_random_item(piece_lists[key]);
}

var classes = ['Fighter', 'Bard', 'Wizard', 'Thief', 'Barbarian', 'Paladin', 'Ranger', 'Druid', 'Cleric'];

piece_lists['globalrestriction'] = [
    'When the moon is full', 
    'When no one is watching', 
    'If your conscience is clear',
    'When you are under a curse',
    'When you are alone',
    'When you are being hunted',
    'When in a large crowd', 
    'When in the wilderness', 
    'When underground', 
    'When there are no witnesses', 
    'When in a large city', 
    'During the day',
    'In the dead of night', 
    'When on a holy quest',
    'When up to no good',
    'When breaking the law',
    'When you are bleeding',
    'When you are at full HP'];

piece_lists['ongoingbonus'] = [
    'you heal for {DICE} wound every day, even without rest', 
    'when you consume a ration roll+{STAT}. On a 7+ you gain the effects but do not mark off a usage',
    'you deal +1 damage', 
    'you can move without making any sound', 
    'your attacks can damage and destroy armor', 
    'you can always sense when someone is close behind you', 
    'any hirelings in your employ have +1 Loyalty, no matter the quality of your leadership', 
    'you heal 1 HP whenever you kill something'];

piece_lists['targettedability'] =...