Skip to content

Instantly share code, notes, and snippets.

@ndugger
Last active August 14, 2019 18:38
Show Gist options
  • Save ndugger/ef0275cc823a1327b4ef4b48e94d81b7 to your computer and use it in GitHub Desktop.
Save ndugger/ef0275cc823a1327b4ef4b48e94d81b7 to your computer and use it in GitHub Desktop.
Dungeon Master Language
use game.
use math.
define dice as blueprint (use number as sides) of game'item, set to:
define roll as action (use number as times, share number), set to:
define value as number, set to 0.
repeat times:
set value to value + do math'round (do math'random (0, sides)).
share value.
share roll.
share dice.
use battle.
use dice.
use game.
define d12 as dice, set to new (12).
do battle'begin.
define attack as number, set to do d12'roll (2).
define critical as number, set to 0.
define damage as number, set to 0.
if attack > 12:
set critical to do d12'roll (1).
set damage to attack + critical.
set battle'target'hp to battle'target'hp - damage.
if battle'target'hp = 0, or battle'target'hp < 0:
do battle'end.
do game'save.
if battle'target'hp > 0:
do battle'continue.
@ndugger
Copy link
Author

ndugger commented Aug 8, 2019

built-in types:

  • action
  • number
  • text

@ndugger
Copy link
Author

ndugger commented Aug 8, 2019

keywords:

  • use
  • define
  • as
  • set _ to
  • if
  • do
  • repeat for
  • share
  • or
  • and

@ndugger
Copy link
Author

ndugger commented Aug 8, 2019

meaningful tokens:

  • <
  • >
  • =
  • ( )
  • '
  • "
  • ,
  • .
  • -
  • +
  • ->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment