(set: $hp to 10)
(set: $coins to 10)
(set: $days to 0)
(set: $level to 1)
(set: $exp to 0)
(set: $king to (datamap: "id", "king", "level", 3, "exp", 100, "next", 0))
(set: $apprentice to (datamap: "id", "apprentice", "level", 0, "exp", 0, "next", $king))
(set: $class to $apprentice)
(set: $big_sword to (datamap: "id", "big sword", "cost", 50, "damage", 5, "next", 0))
(set: $small_sword to (datamap: "id", "small sword", "cost", 30, "damage", 3, "next", $big_sword))
(set: $dagger to (datamap: "id", "dagger", "cost", 10, "damage", 1, "next", $small_sword))
(set: $weapon to $dagger)
(display:"main")You've been adventuring for $days days. You have $coins coins and your health is $hp.
[[rest]]
[[adventure->start adventure]]
[[shop]](set: $hp to 10) (set: $days to $days + 1)
You feel refreshed.
(display: "main")A monster appears! (set: $monster_hp to 3)
[[fight]]
[[flee->main]]Your current weapon is a (print: $weapon's id), which does (print: $weapon's damage) damage.
(set: $next_weapon to $weapon's next)
(if: not ($next_weapon is 0))[
(set: $nwn to $next_weapon's id)
[[buy $nwn->buy]] ((print: $next_weapon's cost) coins, does (print: $next_weapon's damage) damage)]
[[go back home|main]](if: (either: 0, 1) is 0)[
The monster bites you!
(set: $hp to $hp - (either: 1,2,3))
(if: $hp < 1)[ You are [[dead]]! ]
(else:)[ Your health is $hp.
[[fight]]
[[flee|main]] ]
]
(else:)[ You hit the monster!
(set:$monster_hp = $monster_hp - ($weapon's damage))
(if: $monster_hp < 1)[ The [[monster is dead]]! ]
(else:)[
Its health is $monster_hp.
[[fight]]
[[flee|main]] ]
] You are dead! [[restart?|init]]
(set: $streak to $streak + 1)
(set: $drop to (random: 3,10) * $streak)
(set: $spoils to $spoils + $drop)
(set: $exp to $exp + 5)
You collect $drop coins from the monster carcass!
Your spoils are currently $spoils coins.
Your health is $hp.
You're experience points have increased to $exp.
You've killed $streak monster(if: not($streak is 1))[s] on this adventure.
[[continue|adventure]]
[[go home|collect spoils]](set: $spoils to 0) (set: $streak to 0)
(display: "adventure")(set: $coins to $coins + $spoils)
(display: "main")(if: $coins > ($next_weapon's cost))[(set: $weapon to $next_weapon) (set: $coins to $coins - ($weapon's cost)) (display: "shop")]
(else:)[You don't have enough money!
(display: "shop")]