<!DOCTYPE html>
<html>

<head>
	<title>Dungeon World Basic Moves</title>
    <link rel="stylesheet" href="style.css" />
    <script type='text/javascript' src='script.js'></script>
</head>

<body>
	<h1>Dungeon World Basic Moves</h1>
	<div class="leftSide">
    	<div id="basicMoves">
    		<button id="hackAndSlash" onclick="makeYourMove(this.id)">Hack and Slash (roll+STR)</button><br />
    		<button id="volley" onclick="makeYourMove(this.id)">Volley (roll+DEX)</button><br />
    		<button id="defyDanger" onclick="makeYourMove(this.id)">Defy Danger (roll+STAT)</button><br />
    		<button id="defend" onclick="makeYourMove(this.id)">Defend (roll+STAT)</button><br />
    		<button id="spoutLore" onclick="makeYourMove(this.id)">Spout Lore (roll+INT)</button><br />
    		<button id="discernRealities" onclick="makeYourMove(this.id)">Discern Realities (roll+WIS)</button><br />
    		<button id="parley" onclick="makeYourMove(this.id)">Parley (roll+CHA)</button><br />
    		<button id="aidOrInterfere" onclick="makeYourMove(this.id)">Aid or Interfere (roll+BOND)</button><br />
    	</div>

    	<div id="moveDescription">
    	</div>

    	<div style="clear:both;">
    		<div id="showDie1" class="dice">0</div>
    		<div id="showDie2" class="dice">0</div>
    		<input id="abilityModifier" value="0">
    	</div>

        <div id="moveResult" style="clear:both;">
        </div>
	</div>
	
	<div class="rightSide">
	    
	</div>
</body>

</html>
		#basicMoves {
			width:210px;
			text-align:right;
			float:left;
		}
		#basicMoves button {
			width:100%;
		}
		#showDice {
			float:left;
		}
		div.dice {
			float:left;
			width:30px;
			background:#ffffff;
			border:#000000 1px solid;
			padding:10px;
			font-size:24px;
			text-align:center;
			margin:10px;
		}
		#abilityModifier {
			float:left;
			width:50px;
			background:#ffffff;
			border:#000000 1px solid;
			padding:10px;
			font-size:24px;
			text-align:center;
			margin:10px;
		}
		function diceRoll(sides) {
			return Math.floor(Math.random() * sides) + 1;
		}
		function moveDescription(buttonID,total) {
			var hack_and_slash_results = ["<strong>10+</strong> Deal your damage to the enemy and avoid their attack, or deal your damage +1d6 and expose yourself to the enemy's attack.","<strong>7-9</strong> Deal your damage to the enemy, and the enemy makes an attack against you.","<strong>Miss</strong>"];
			var volley_results = ["<strong>10+</strong> You have a clear shot-deal your damage.","<strong>7-9</strong> Choose one: <ul><li>You have to move to get the shot, placing you in danger as described by the GM</li><li>You have to take what you can get: -1d6 damage</li><li>You have to take several shots, reducing your ammo by one</li></ul>","<strong>Miss</strong>"];
			var defy_danger_results = ["<strong>10+</strong> You do what you set out to, the threat doesn't come to bear.","<strong>7-9</strong> You stumble, hesitate, or flinch: the GM will offer you a worse outcome, hard bargain, or ugly choice.","<strong>Miss</strong>"];
			var defend_results = ["<strong>10+</strong> Hold 3<br />So long as you stand in defense, when you or the thing you defend is attacked you may spend hold, 1 for 1, to choose an option:<ul><li>Redirect an attack from the thing you defend to yourself</li><li>Halve the attack's effect or daamge</li><li>Open up the attacker to an ally, giving that ally +1 forward against the attacker</li><li>Deal damage to the attacker equal to your level</li></ul>","<strong>7-9</strong> Hold 1<br />So long as you stand in defense, when you or the thing you defend is attacked you may spend hold, 1 for 1, to choose an option:<ul><li>Redirect an attack from the thing you defend to yourself</li><li>Halve the attack's effect or daamge</li><li>Open up the attacker to an ally, giving that ally +1 forward against the attacker</li><li>Deal damage to the attacker equal to your level</li></ul>","<strong>Miss</strong>","<br />As long as you stand in defense, when you or the thing you defend is attacked you may spend hold, 1 for 1, to choose an option:<ul><li>Redirect an attack from the thing you defend to yourself</li><li>Halve the attack's effect or damage</li><li>Open up the attacker to an ally, giving that ally +1 forward against the attacker</li><li>Deal damage to the attacker equal to your level</li><ul>"];
			var spout_lore_results = ["<strong>10+</strong> The GM will tell you something interesting and useful about the subject relevant to your situation.","<strong>7-9</strong> The GM will only tell you something interesting-it's on you to make it useful.","<strong>Miss</strong>","<br />The GM might ask you 'How do you know this?' Tell them the truth, now."];
			var discern_realities_results = ["<strong>10+</strong> Ask the GM 3 questions from the list below.<br />Take +1 forward when acting on the answers.<ul><li>What happened here recently?</li><li>What is about to happen?</li><li>What shoud I be on the lookout for?</li><li>What here is useful or valuable to me?</li><li>Who's really in control here?</li><li>What here is not what it appears to be?</li></ul>.","<strong>7-9</strong> Ask 1.<br />Take +1 forward when acting on the answers.<ul><li>What happened here recently?</li><li>What is about to happen?</li><li>What shoud I be on the lookout for?</li><li>What here is useful or valuable to me?</li><li>Who's really in control here?</li><li>What here is not what it appears to be?</li></ul>.","<strong>Miss</strong>"];
			var parley_results = ["<strong>10+</strong> They do what you ask if you first promise what they ask of you.","<strong>7-9</strong> They will do what you ask, but need some concrete assurance of your promise, right now.","<strong>Miss</strong>"];
			var aid_or_interfere_results = ["<strong>10+</strong> They take +1 or -1 to their roll, your choice.","<strong>7-9</strong> They still get a modifier, but you also expose yourself to danger, retribution, or cost.","<strong>Miss</strong>"];
			var moveArray = [];
			switch(buttonID) {
				case "hackAndSlash":
					moveArray = hack_and_slash_results;
				break;
				case "volley":
					moveArray = volley_results;
				break;
				case "defyDanger":
					moveArray = defy_danger_results;
				break;
				case "defend":
					moveArray = defend_results;
				break;
				case "spoutLore":
					moveArray = spout_lore_results;
				break;
				case "discernRealities":
					moveArray = discern_realities_results;
				break;
				case "parley":
					moveArray = parley_results;
				break;
				case "aidOrInterfere":
					moveArray = aid_or_interfere_results;
				break;
			}
			switch(true) {
				case total >= 10:
					return moveArray[0];
				break;
				case total <10 && total >= 7:
					return moveArray[1];
				break;
				default:
					return moveArray[2];
				break;
			}
		}
		function makeYourMove(buttonID) {
			var firstDie = diceRoll(6);
			var secondDie = diceRoll(6);
			var diceTotal = firstDie + secondDie + parseInt(document.getElementById("abilityModifier").value);
			var moveText = moveDescription(buttonID,diceTotal);
			showDie1.innerHTML = firstDie; //shows the results of firstDie
			showDie2.innerHTML = secondDie; //shows the results of secondDie
			document.getElementById("moveResult").innerHTML=moveText;
		}
Created from scratch
0 forks
276 views

Browse more Codebits